Merge "msm: kgsl: Fix overflow in sharedmem cache range operation function"
This commit is contained in:
commit
5587de21d7
1 changed files with 3 additions and 4 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue