Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb-usb: opera1: fix uninit-value in dvb_usb_adapter_dvb_init

If opera1_xilinx_rw fails, the mac address is not initialized.
And opera1_read_mac_address does not handle this failure, which leads to
the uninit-value in dvb_usb_adapter_dvb_init.

Fix this by handling the failure of opera1_xilinx_rw.

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Zhang Shurong and committed by
Hans Verkuil
f7e0f1f5 1047f934

+7 -2
+7 -2
drivers/media/usb/dvb-usb/opera1.c
··· 439 439 440 440 static int opera1_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) 441 441 { 442 + int ret; 442 443 u8 command[] = { READ_MAC_ADDR }; 443 - opera1_xilinx_rw(d->udev, 0xb1, 0xa0, command, 1, OPERA_WRITE_MSG); 444 - opera1_xilinx_rw(d->udev, 0xb1, 0xa1, mac, 6, OPERA_READ_MSG); 444 + ret = opera1_xilinx_rw(d->udev, 0xb1, 0xa0, command, 1, OPERA_WRITE_MSG); 445 + if (ret) 446 + return ret; 447 + ret = opera1_xilinx_rw(d->udev, 0xb1, 0xa1, mac, 6, OPERA_READ_MSG); 448 + if (ret) 449 + return ret; 445 450 return 0; 446 451 } 447 452 static int opera1_xilinx_load_firmware(struct usb_device *dev,