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

Commit 06df5489 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: Protect against a potential overflow in kgsl_sg_alloc"

parents cb6693f4 9d6495a8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -137,6 +137,9 @@ kgsl_sharedmem_map_vma(struct vm_area_struct *vma,

static inline void *kgsl_sg_alloc(unsigned int sglen)
{
	if (sglen >= ULONG_MAX / sizeof(struct scatterlist))
		return NULL;

	if ((sglen * sizeof(struct scatterlist)) <  PAGE_SIZE)
		return kzalloc(sglen * sizeof(struct scatterlist), GFP_KERNEL);
	else