mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
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: Sandeep Patil <sspatil@google.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user