diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2014-11-11 11:40:47 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-12 00:24:08 +0300 |
commit | 8bca81d9875c7768c40a19fb439eebaf6cec898d (patch) | |
tree | f0e709326fc9292781a2000fde5f8ae88102d94c /drivers/net/usb/smsc95xx.c | |
parent | d65c4e4e0aeb699e984bd4b382efffab418aa359 (diff) | |
download | linux-8bca81d9875c7768c40a19fb439eebaf6cec898d.tar.xz |
usbnet: smsc95xx: dereferencing NULL pointer
we were dereferencing dev to initialize pdata. but just after that we
have a BUG_ON(!dev). so we were basically dereferencing the pointer
first and then tesing it for NULL.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/smsc95xx.c')
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index d07bf4cb893f..26423adc35ee 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1670,12 +1670,14 @@ done: static int smsc95xx_resume(struct usb_interface *intf) { struct usbnet *dev = usb_get_intfdata(intf); - struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); - u8 suspend_flags = pdata->suspend_flags; + struct smsc95xx_priv *pdata; + u8 suspend_flags; int ret; u32 val; BUG_ON(!dev); + pdata = (struct smsc95xx_priv *)(dev->data[0]); + suspend_flags = pdata->suspend_flags; netdev_dbg(dev->net, "resume suspend_flags=0x%02x\n", suspend_flags); |