diff mbox series

gspca/sq905.c: fix uninitialized variable

Message ID 2c46832a-99a8-73bf-ec85-085052f8b4db@xs4all.nl
State New
Headers show
Series gspca/sq905.c: fix uninitialized variable | expand

Commit Message

Hans Verkuil March 11, 2021, 2:46 p.m. UTC
act_len can be uninitialized if usb_bulk_msg() returns an error.
Set it to 0 to avoid a KMSAN error.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+a4e309017a5f3a24c7b3@syzkaller.appspotmail.com
---
diff mbox series

Patch

diff --git a/drivers/media/usb/gspca/sq905.c b/drivers/media/usb/gspca/sq905.c
index 97799cfb832e..949111070971 100644
--- a/drivers/media/usb/gspca/sq905.c
+++ b/drivers/media/usb/gspca/sq905.c
@@ -158,7 +158,7 @@  static int
 sq905_read_data(struct gspca_dev *gspca_dev, u8 *data, int size, int need_lock)
 {
 	int ret;
-	int act_len;
+	int act_len = 0;

 	gspca_dev->usb_buf[0] = '\0';
 	if (need_lock)