From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Yury Norov <ynorov@nvidia.com>,
Russell King <linux@armlinux.org.uk>,
Jason Gunthorpe <jgg@ziepe.ca>,
Danilo Krummrich <dakr@kernel.org>,
Leon Romanovsky <leon@kernel.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Douglas Anderson <dianders@chromium.org>,
Kees Cook <kees@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] ARM: dma-mapping: Treat bitmap size as allocation failure
Date: Thu, 9 Jul 2026 07:58:24 +0200 [thread overview]
Message-ID: <acf7d2c0-071f-41d2-a65e-a5313a1b55c6@samsung.com> (raw)
In-Reply-To: <20260709020312.133977-2-ynorov@nvidia.com>
On 09.07.2026 04:03, 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.
>
> Signed-off-by: Yury Norov <ynorov@nvidia.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> arch/arm/mm/dma-mapping.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index f9bc53b60f99..7761099dde9e 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -773,7 +773,7 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping,
> start = bitmap_find_next_zero_area(mapping->bitmaps[i],
> mapping->bits, 0, count, align);
>
> - if (start > mapping->bits)
> + if (start >= mapping->bits)
> continue;
>
> bitmap_set(mapping->bitmaps[i], start, count);
> @@ -794,7 +794,7 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping,
> start = bitmap_find_next_zero_area(mapping->bitmaps[i],
> mapping->bits, 0, count, align);
>
> - if (start > mapping->bits) {
> + if (start >= mapping->bits) {
> spin_unlock_irqrestore(&mapping->lock, flags);
> return DMA_MAPPING_ERROR;
> }
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2026-07-09 5:58 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 [this message]
2026-07-09 2:03 ` [PATCH 2/5] powerpc/msi: " Yury Norov
2026-07-21 9:16 ` Madhavan Srinivasan
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=acf7d2c0-071f-41d2-a65e-a5313a1b55c6@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=dakr@kernel.org \
--cc=dianders@chromium.org \
--cc=jgg@ziepe.ca \
--cc=kees@kernel.org \
--cc=leon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=willy@infradead.org \
--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®