mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
powerpc/msi: Treat bitmap size as allocation failure
bitmap_find_next_zero_area() uses an out-of-range return value to indicate failure. Check for values greater than or equal to the bitmap size so the caller does not depend on the exact failure sentinel. Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Signed-off-by: Yury Norov <ynorov@nvidia.com>
This commit is contained in:
@@ -21,7 +21,7 @@ int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num)
|
||||
|
||||
offset = bitmap_find_next_zero_area(bmp->bitmap, bmp->irq_count, 0,
|
||||
num, (1 << order) - 1);
|
||||
if (offset > bmp->irq_count)
|
||||
if (offset >= bmp->irq_count)
|
||||
goto err;
|
||||
|
||||
bitmap_set(bmp->bitmap, offset, num);
|
||||
|
||||
Reference in New Issue
Block a user