Skip to content

Commit a3fd1ef

Browse files
harperchenmchehab
authored andcommitted
media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address
In su3000_read_mac_address, if i2c_transfer fails to execute two messages, array mac address will not be initialized. Without handling such error, later in function dvb_usb_adapter_dvb_init, proposed_mac is accessed before initialization. Fix this error by returning a negative value if message execution fails. Link: https://lore.kernel.org/linux-media/20230328124416.560889-1-harperchen1110@gmail.com Signed-off-by: Wei Chen <harperchen1110@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 9ded5bd commit a3fd1ef

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/media/usb/dvb-usb/dw2102.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
946946
for (i = 0; i < 6; i++) {
947947
obuf[1] = 0xf0 + i;
948948
if (i2c_transfer(&d->i2c_adap, msg, 2) != 2)
949-
break;
949+
return -1;
950950
else
951951
mac[i] = ibuf[0];
952952
}

0 commit comments

Comments
 (0)