Hi!
From: Oliver Neukum oneukum@suse.com
commit 6c22fce07c97f765af1808ec3be007847e0b47d1 upstream.
Coverity reports:
** CID 751368: Null pointer dereferences (FORWARD_NULL) /drivers/net/usb/usbnet.c: 1925 in __usbnet_read_cmd()
There's something wrong here. Changelog is cut, so signed-offs are missing. It is wrong in git, too.
There's something wrong with the whitespace in the patch (indentation by 4 spaces instead of tab), too.
Best regards, Pavel
--- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1960,8 +1960,13 @@ static int __usbnet_read_cmd(struct usbn err = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), cmd, reqtype, value, index, buf, size, USB_CTRL_GET_TIMEOUT);
- if (err > 0 && err <= size)
memcpy(data, buf, err);
- if (err > 0 && err <= size) {
if (data)
memcpy(data, buf, err);
else
netdev_dbg(dev->net,
"Huh? Data requested but thrown away.\n");
- } kfree(buf);
out: return err; @@ -1982,7 +1987,13 @@ static int __usbnet_write_cmd(struct usb buf = kmemdup(data, size, GFP_KERNEL); if (!buf) goto out;
- }
- } else {
if (size) {
WARN_ON_ONCE(1);
err = -EINVAL;
goto out;
}
- }
err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), cmd, reqtype, value, index, buf, size,