The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: 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: Re: [PATCH] media: synopsys: hdmirx: fix integer overflow in hdmirx_get_edid()
Date: Fri, 9 Jan 2026 01:26:48 +0300	[thread overview]
Message-ID: <af5546be-50d3-404a-be76-297139988b80@collabora.com> (raw)
In-Reply-To: <aWANkxRApxDeReRW@stanley.mountain>

On 1/8/26 23:03, Dan Carpenter wrote:
> 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);

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

-- 
Best regards,
Dmitry

      reply	other threads:[~2026-01-08 22:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 20:03 [PATCH] media: synopsys: hdmirx: fix integer overflow in hdmirx_get_edid() Dan Carpenter
2026-01-08 22:26 ` Dmitry Osipenko [this message]

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=af5546be-50d3-404a-be76-297139988b80@collabora.com \
    --to=dmitry.osipenko@collabora.com \
    --cc=dan.carpenter@linaro.org \
    --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 \
    /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