media: gspca/sq905.c: fix uninitialized variable
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 11 Mar 2021 14:46:40 +0000 (15:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:40:17 +0000 (10:40 +0200)
[ Upstream commit eaaea4681984c79d2b2b160387b297477f0c1aab ]

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
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/gspca/sq905.c

index a7ae0ec9fa919a7b108793ec7500f5b7b44d5068..03322d2b2e8290ab4c6fd12d8191692fc27d2073 100644 (file)
@@ -172,7 +172,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)