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

Commit e4dee59f authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

ion: msm: Only check heap IDs if the heap has been initialized



The get_ion_heap() code blindly checks heap IDs in the array
of heap pointers without checking to see if the heap pointer
is valid, which can cause a NULL pointer to be dereferenced.

Add a check before inspecting the heap ID to ensure that the
heap pointer is valid.

Change-Id: I2ecdc652460878446e3f2daa2379e04ac021d75c
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 99878ea1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ struct ion_heap *get_ion_heap(int heap_id)

	for (i = 0; i < num_heaps; i++) {
		heap = heaps[i];
		if (heap->id == heap_id)
		if (heap && heap->id == heap_id)
			return heap;
	}