public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] media: cxusb: fix uninitialized var in cxusb_gpio_tuner()
@ 2025-04-05  7:31 Penglei Jiang
  2025-04-25 10:40 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Penglei Jiang @ 2025-04-05  7:31 UTC (permalink / raw)
  To: mkrufky, mchehab; +Cc: linux-media, linux-kernel, Penglei Jiang

The function cxusb_ctrl_msg() may not set the value of the variable i,
but the code uses it later. Initialize the local variable i to 0 to
prevent potential issues.

Reported-by: syzbot+526bd95c0ec629993bf3@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/67f092b5.050a0220.0a13.0229.GAE@google.com
Signed-off-by: Penglei Jiang <superman.xpt@gmail.com>
---
V1 -> V2: Updated the Subject

 drivers/media/usb/dvb-usb/cxusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index f44529b40989..7fe858bb665e 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -111,7 +111,7 @@ int cxusb_ctrl_msg(struct dvb_usb_device *d,
 static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
 {
 	struct cxusb_state *st = d->priv;
-	u8 o[2], i;
+	u8 o[2], i = 0;
 
 	if (st->gpio_write_state[GPIO_TUNER] == onoff &&
 	    !st->gpio_write_refresh[GPIO_TUNER])
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media: cxusb: fix uninitialized var in cxusb_gpio_tuner()
  2025-04-05  7:31 [PATCH v2] media: cxusb: fix uninitialized var in cxusb_gpio_tuner() Penglei Jiang
@ 2025-04-25 10:40 ` Hans Verkuil
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2025-04-25 10:40 UTC (permalink / raw)
  To: Penglei Jiang, mkrufky, mchehab; +Cc: linux-media, linux-kernel

Hi Penglei Jiang.

On 05/04/2025 09:31, Penglei Jiang wrote:
> The function cxusb_ctrl_msg() may not set the value of the variable i,
> but the code uses it later. Initialize the local variable i to 0 to
> prevent potential issues.
> 
> Reported-by: syzbot+526bd95c0ec629993bf3@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/67f092b5.050a0220.0a13.0229.GAE@google.com
> Signed-off-by: Penglei Jiang <superman.xpt@gmail.com>

FYI: I marked this as Obsolete since this patch is a better solution:

https://patchwork.linuxtv.org/project/linux-media/patch/tencent_DCC6C1B37B437AC965C3A2845B5779D76305@qq.com/

Regards,

	Hans

> ---
> V1 -> V2: Updated the Subject
> 
>  drivers/media/usb/dvb-usb/cxusb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
> index f44529b40989..7fe858bb665e 100644
> --- a/drivers/media/usb/dvb-usb/cxusb.c
> +++ b/drivers/media/usb/dvb-usb/cxusb.c
> @@ -111,7 +111,7 @@ int cxusb_ctrl_msg(struct dvb_usb_device *d,
>  static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
>  {
>  	struct cxusb_state *st = d->priv;
> -	u8 o[2], i;
> +	u8 o[2], i = 0;
>  
>  	if (st->gpio_write_state[GPIO_TUNER] == onoff &&
>  	    !st->gpio_write_refresh[GPIO_TUNER])


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-25 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-05  7:31 [PATCH v2] media: cxusb: fix uninitialized var in cxusb_gpio_tuner() Penglei Jiang
2025-04-25 10:40 ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox