[PATCH 1/4] media: zoran: remove always-false buffer size check

From: Minseo Park

Date: Wed Nov 25 2026 - 02:06:25 EST


zoran_v4l_set_format() assigns zr->buffer_size and then immediately
compares the very same expression against it:

zr->buffer_size = height * width * bpp;

/* Check against available buffer size */
if (height * width * bpp > zr->buffer_size) {

The condition can never be true, so the check and its error path are
dead code.

The comparison used to be made against fh->buffers.buffer_size, the size
of the buffers that had already been allocated for the file handle,
which made it a real bounds check. The assignment on the line above
turned the right hand side into the value that had just been computed,
so nothing is verified any more.

Remove the dead check. No functional change.

Signed-off-by: Minseo Park <hiyoukou@xxxxxxxxx>
---
drivers/media/pci/zoran/zoran_driver.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index 5b4d5dd06edb..a053365922c4 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -179,13 +179,6 @@ static int zoran_v4l_set_format(struct zoran *zr, int width, int height,

zr->buffer_size = height * width * bpp;

- /* Check against available buffer size */
- if (height * width * bpp > zr->buffer_size) {
- pci_dbg(zr->pci_dev, "%s - video buffer size (%d kB) is too small\n",
- __func__, zr->buffer_size >> 10);
- return -EINVAL;
- }
-
/* The video front end needs 4-byte alinged line sizes */

if ((bpp == 2 && (width & 1)) || (bpp == 3 && (width & 3))) {
--
2.43.0