msm: kgsl: avoid zero length scatterlist allocation
During sglist allocation we calculate sglen as
per below
sglen_alloc = PAGE_ALIGN(size) >> PAGE_SHIFT;
sglen_alloc can be zero if size falls within the
last page. For example, when size = 0xFFFF_FF7B,
PAGE_ALIGN(0xFFFF_FF7B) will be 0, considering
0x1000 (4kb) PAGE_SIZE. if kzalloc() with
zero size, it will return ZERO_SIZE_PTR which is
not NULL and we always do NULL check. Dereferencing
ZERO_SIZE_PTR will lead to a distinct access fault.
Change-Id: Ibcc6198438c13b5111be0faa736328db92511597
CRs-Fixed: 563106
Signed-off-by:
Prakash Kamliya <pkamliya@codeaurora.org>
Loading
Please register or sign in to comment