Skip to contentSkip to conversation

media: go7007: add check of return value of go7007_read_addr()

PATCH New Daniil Dulov 1 participant 1 message Feb 11, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: go7007: add check of return value of go7007_read_addr()

If go7007_read_addr() returns error channel is not assigned a value. In this case go to allocfail.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 866b8695d67e ("Staging: add the go7007 video driver")
---
 drivers/media/usb/go7007/go7007-usb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/go7007/go7007-usb.c +3 -1
index eeb85981e02b..762c13e49bfa 100644
@@ -1201,7 +1201,9 @@ static int go7007_usb_probe(struct usb_interface *intf,
 				u16 channel;
 
 				/* read channel number from GPIO[1:0] */
-				go7007_read_addr(go, 0x3c81, &channel);
+				if (go7007_read_addr(go, 0x3c81, &channel))
+					goto allocfail;
+
 				channel &= 0x3;
 				go->board_id = GO7007_BOARDID_ADLINK_MPG24;
 				usb->board = board = &board_adlink_mpg24;
Signature · 1 line
2.25.1