mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Madhavan Srinivasan <maddy@linux.ibm.com>
To: Yury Norov <ynorov@nvidia.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] powerpc/msi: Treat bitmap size as allocation failure
Date: Tue, 21 Jul 2026 14:46:00 +0530	[thread overview]
Message-ID: <32f5998a-6ae7-4556-a78a-760e78d18e87@linux.ibm.com> (raw)
In-Reply-To: <20260709020312.133977-3-ynorov@nvidia.com>


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 <maddy@linux.ibm.com>

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 <ynorov@nvidia.com>
> ---
>   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);

  reply	other threads:[~2026-07-21  9:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  2:03 [PATCH 0/5] bitmap: align bitmap_find_next_zero_area_off() output with the rest of the API Yury Norov
2026-07-09  2:03 ` [PATCH 1/5] ARM: dma-mapping: Treat bitmap size as allocation failure Yury Norov
2026-07-09  5:58   ` Marek Szyprowski
2026-07-09  2:03 ` [PATCH 2/5] powerpc/msi: " Yury Norov
2026-07-21  9:16   ` Madhavan Srinivasan [this message]
2026-07-09  2:03 ` [PATCH 3/5] crypto: ccp: " Yury Norov
2026-07-09  2:03 ` [PATCH 4/5] media: s5p-mfc: " Yury Norov
2026-07-09  5:57   ` Marek Szyprowski
2026-07-09  2:03 ` [PATCH 5/5] bitmap: Return size when no zero area is found Yury Norov
2026-07-22 19:31 ` [PATCH 0/5] bitmap: align bitmap_find_next_zero_area_off() output with the rest of the API Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32f5998a-6ae7-4556-a78a-760e78d18e87@linux.ibm.com \
    --to=maddy@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ynorov@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®