[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0b8e0098-b3a6-4abb-b856-65b7ba4e4c3d@xs4all.nl>
Date: Mon, 29 Apr 2024 16:24:27 +0200
From: Hans Verkuil <hverkuil@...all.nl>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Hans Verkuil <hverkuil-cisco@...all.nl>, Michael Bunk
<micha@...edict.org>, Wei Chen <harperchen1110@...il.com>,
Yu Zhe <yuzhe@...china.com>, Zhang Shurong <zhang_shurong@...mail.com>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org
Subject: Re: [PATCH] media: dw2102: fix a potential buffer overflow
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@...all.nl>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@...nel.org>
Reviewed-by: Hans Verkuil <hverkuil@...all.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;
Powered by blists - more mailing lists