diff options
author | Colin Ian King <colin.king@canonical.com> | 2013-03-15 18:14:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-15 19:51:01 +0100 |
commit | a1645eefc8358d0a9dbeba254e51aa89de4d80a4 (patch) | |
tree | 28e67aa52534b4e66b0c8eaff3980d718fe84be3 /drivers/usb/misc/sisusbvga | |
parent | driver: usb: storage: remove cast for kmalloc return value (diff) | |
download | linux-a1645eefc8358d0a9dbeba254e51aa89de4d80a4.tar.xz linux-a1645eefc8358d0a9dbeba254e51aa89de4d80a4.zip |
usb: misc: sisusbvga: Avoid NULL pointer dereference from sisusb
A failed kzalloc() is reported with a dev_err that dereferences the null
sisusb, this will cause a NULL pointer deference error.
Instead, pass dev->dev to the dev_err() rather than &sisusb->sisusb_dev->dev
Smatch analysis:
drivers/usb/misc/sisusbvga/sisusb.c:3087 sisusb_probe() error: potential null
dereference 'sisusb'. (kzalloc returns null)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/sisusbvga')
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index dd573abd2d1e..c21386ec5d35 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -3084,7 +3084,7 @@ static int sisusb_probe(struct usb_interface *intf, /* Allocate memory for our private */ if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) { - dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for private data\n"); + dev_err(&dev->dev, "Failed to allocate memory for private data\n"); return -ENOMEM; } kref_init(&sisusb->kref); |