Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c4cacce authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Fix overflow in sharedmem cache range operation function"

parents cd0604f8 70496cbb
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -574,12 +574,11 @@ int kgsl_cache_range_op(struct kgsl_memdesc *memdesc, uint64_t offset,
	void *addr = (memdesc->hostptr) ?
		memdesc->hostptr : (void *) memdesc->useraddr;

	/* Make sure that size is non-zero */
	if (!size)
	if (size == 0 || size > UINT_MAX)
		return -EINVAL;

	/* Make sure that the offset + size isn't bigger than we can handle */
	if ((offset + size) > ULONG_MAX)
	/* Make sure that the offset + size does not overflow */
	if ((offset + size < offset) || (offset + size < size))
		return -ERANGE;

	/* Make sure the offset + size do not overflow the address */