Skip to content
Snippets Groups Projects
Commit 09a22c66 authored by Rajesh Kemisetti's avatar Rajesh Kemisetti Committed by Yuan Lin
Browse files

msm: kgsl: Add missing checks for alloc size and sglen


In _kgsl_sharedmem_page_alloc():

- Make len of type size_t to be in line with size.
- Check for boundary limits of requested alloc size before honoring.
- Make sure sglen is greater than zero before marking it as end
of sg list.

Bug: 27475454
Change-Id: I5389bcef3478f2ccf2be5f719049867496235f28
Signed-off-by: default avatarYuan Lin <yualin@google.com>
parent 2c357471
Branches
Tags android-6.0.1_r0.81
No related merge requests found
......@@ -580,10 +580,15 @@ _kgsl_sharedmem_page_alloc(struct kgsl_memdesc *memdesc,
size_t size)
{
int order, ret = 0;
int len, page_size, sglen_alloc, sglen = 0;
int page_size, sglen_alloc, sglen = 0;
void *ptr;
size_t len;
unsigned int align;
size = PAGE_ALIGN(size);
if (size == 0 || size > UINT_MAX)
return -EINVAL;
align = (memdesc->flags & KGSL_MEMALIGN_MASK) >> KGSL_MEMALIGN_SHIFT;
page_size = (align >= ilog2(SZ_64K) && size >= SZ_64K)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment