From: Dan Carpenter <dan.carpenter@linaro.org>
To: Shreeya Patel <shreeya.patel@collabora.com>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Dingxian Wen <shawn.wen@rock-chips.com>,
Hans Verkuil <hverkuil@kernel.org>,
linux-media@vger.kernel.org, kernel@collabora.com,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] media: synopsys: hdmirx: fix integer overflow in hdmirx_get_edid()
Date: Thu, 8 Jan 2026 23:03:31 +0300 [thread overview]
Message-ID: <aWANkxRApxDeReRW@stanley.mountain> (raw)
The "edid->blocks" variable comes from the user via the ioctl. It's
a u32 and "edid->start_block" is a u32 too. The addition operation
could have an integer wrapping bug, so use the size_add() function to
prevent that.
Cc: stable@vger.kernel.org
Fixes: 7b59b132ad43 ("media: platform: synopsys: Add support for HDMI input driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
index c3007e09bc9f..f054e30cbfb0 100644
--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
+++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
@@ -717,7 +717,7 @@ static int hdmirx_get_edid(struct file *file, void *fh, struct v4l2_edid *edid)
if (edid->start_block >= hdmirx_dev->edid_blocks_written || !edid->blocks)
return -EINVAL;
- if (edid->start_block + edid->blocks > hdmirx_dev->edid_blocks_written)
+ if (size_add(edid->start_block, edid->blocks) > hdmirx_dev->edid_blocks_written)
edid->blocks = hdmirx_dev->edid_blocks_written - edid->start_block;
memcpy(edid->edid, hdmirx_dev->edid, edid->blocks * EDID_BLOCK_SIZE);
--
2.51.0
next reply other threads:[~2026-01-08 20:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 20:03 Dan Carpenter [this message]
2026-01-08 22:26 ` [PATCH] media: synopsys: hdmirx: fix integer overflow in hdmirx_get_edid() Dmitry Osipenko
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=aWANkxRApxDeReRW@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=dmitry.osipenko@collabora.com \
--cc=hverkuil@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=shawn.wen@rock-chips.com \
--cc=shreeya.patel@collabora.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