Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Michael Bunk <micha@freedict.org>,
	Wei Chen <harperchen1110@gmail.com>, Yu Zhe <yuzhe@nfschina.com>,
	Zhang Shurong <zhang_shurong@foxmail.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] media: dw2102: fix a potential buffer overflow
Date: Mon, 29 Apr 2024 16:24:27 +0200	[thread overview]
Message-ID: <0b8e0098-b3a6-4abb-b856-65b7ba4e4c3d@xs4all.nl> (raw)
In-Reply-To: <989d1befaf0ba99277ad7b1f6ef2d454afa6db51.1714400241.git.mchehab@kernel.org>

On 29/04/2024 16:17, Mauro Carvalho Chehab wrote:
> As pointed by smatch:
> 	 drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error: __builtin_memcpy() '&state->data[4]' too small (64 vs 67)
> 
> That seemss to be due to a wrong copy-and-paste.
> 
> Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>

Regards,

	Hans

> ---
>  drivers/media/usb/dvb-usb/dw2102.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
> index 03b411ad64bb..79e2ccf974c9 100644
> --- a/drivers/media/usb/dvb-usb/dw2102.c
> +++ b/drivers/media/usb/dvb-usb/dw2102.c
> @@ -789,7 +789,7 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
>  
>  			if (msg[j].flags & I2C_M_RD) {
>  				/* single read */
> -				if (1 + msg[j].len > sizeof(state->data)) {
> +				if (4 + msg[j].len > sizeof(state->data)) {
>  					warn("i2c rd: len=%d is too big!\n", msg[j].len);
>  					num = -EOPNOTSUPP;
>  					break;


      reply	other threads:[~2024-04-29 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 14:17 [PATCH] media: dw2102: fix a potential buffer overflow Mauro Carvalho Chehab
2024-04-29 14:24 ` Hans Verkuil [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=0b8e0098-b3a6-4abb-b856-65b7ba4e4c3d@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=harperchen1110@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=micha@freedict.org \
    --cc=yuzhe@nfschina.com \
    --cc=zhang_shurong@foxmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).