Re: [PATCH 2/5] powerpc/msi: Treat bitmap size as allocation failure

Madhavan Srinivasan <[email protected]>
Newsgroups gmane.linux.ports.ppc.embedded,gmane.linux.kernel
Message-ID <[email protected]>
On 7/9/26 7:33 AM, Yury Norov wrote:
> 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.
Changes seems to fine.
Acked-by: Madhavan Srinivasan <[email protected]>

When reviewing this, I did find the return value of 
bitmap_find_next_zero_area
to be unsigned long, but we are casting it to int. Not as concern at 
this point
this will be an issue when irq_count exceeds. May be a follow patch is 
needed
to fix this I guess.
Maddy

> Signed-off-by: Yury Norov <[email protected]>
> ---
>   arch/powerpc/sysdev/msi_bitmap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
> index 456a4f64ae0a..2f38d4b41ad3 100644
> --- a/arch/powerpc/sysdev/msi_bitmap.c
> +++ b/arch/powerpc/sysdev/msi_bitmap.c
> @@ -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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.