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

Commit 577bbfcf authored by Sandeep Patil's avatar Sandeep Patil
Browse files

staging: ion: fix off-by-1 error in heap search



ion allocation was wrong because of an off-by-1 error
in heap search for buffer allocation. Fix it.

Bug: 140507100
Test: ion-unit-tests

Change-Id: I6ac5b0ddc6b31b5409645f62a96781d464b7bdf3
Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
parent b7ee32b1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ static int ion_assign_heap_id(struct ion_heap *heap, struct ion_device *dev)

	if (test_and_set_bit(id_bit - 1, dev->heap_ids))
		return -EEXIST;
	heap->id = id_bit;
	heap->id = id_bit - 1;
	dev->heap_cnt++;

	return 0;
@@ -392,7 +392,7 @@ void ion_device_remove_heap(struct ion_heap *heap)
			__func__, heap->name);
	}
	debugfs_remove_recursive(heap->debugfs_dir);
	clear_bit(heap->id - 1, dev->heap_ids);
	clear_bit(heap->id, dev->heap_ids);
	dev->heap_cnt--;
	up_write(&dev->lock);
}