All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Yury Norov <ynorov@nvidia.com>
Subject: [PATCH 4/5] media: s5p-mfc: Treat bitmap size as allocation failure
Date: Wed,  8 Jul 2026 22:03:10 -0400	[thread overview]
Message-ID: <20260709020312.133977-5-ynorov@nvidia.com> (raw)
In-Reply-To: <20260709020312.133977-1-ynorov@nvidia.com>

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>
---
 drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c
index 5ba791fa3676..b25ad2a37196 100644
--- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c
+++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.c
@@ -43,7 +43,7 @@ int s5p_mfc_alloc_priv_buf(struct s5p_mfc_dev *dev, unsigned int mem_ctx,
 
 	if (dev->mem_virt) {
 		start = bitmap_find_next_zero_area(dev->mem_bitmap, bits, 0, count, align);
-		if (start > bits)
+		if (start >= bits)
 			goto no_mem;
 
 		bitmap_set(dev->mem_bitmap, start, count);
-- 
2.53.0



  parent reply	other threads:[~2026-07-09  2:03 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
2026-07-09  2:03 ` [PATCH 3/5] crypto: ccp: " Yury Norov
2026-07-09  2:03 ` Yury Norov [this message]
2026-07-09  5:57   ` [PATCH 4/5] media: s5p-mfc: " 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=20260709020312.133977-5-ynorov@nvidia.com \
    --to=ynorov@nvidia.com \
    --cc=andrzej.hajda@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.