diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-02-13 11:15:35 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-13 16:55:45 -0800 |
commit | 5b89db0e84bef81f6aa324f8f22a9258ff873de3 (patch) | |
tree | 6672d8af700cdc0424b800bde17082622e2de96d /drivers/atm/solos-pci.c | |
parent | c978e7bb77dfd2cd3d1f547fa4e395cfe47f02b2 (diff) |
Net, USB, Option, hso: Do not dereference NULL pointer
In drivers/net/usb/hso.c::hso_create_bulk_serial_device() we have this
code:
...
serial = kzalloc(sizeof(*serial), GFP_KERNEL);
if (!serial)
goto exit;
...
exit:
hso_free_tiomget(serial);
...
hso_free_tiomget() directly dereferences its argument, which in the
example above is a NULL pointer, ouch.
I could just add a 'if (serial)' test at the 'exit' label, but since most
freeing functions in the kernel accept NULL pointers (and it seems like
this was also assumed here) I opted to instead change 'hso_free_tiomget()'
so that it is safe to call it with a NULL argument. I also modified the
function to get rid of a pointles conditional before the call to
'usb_free_urb()' since that function already tests for NULL itself -
besides fixing the NULL deref this change also buys us a few bytes in
size.
Before:
$ size drivers/net/usb/hso.o
text data bss dec hex filename
32200 592 9960 42752 a700 drivers/net/usb/hso.o
After:
$ size drivers/net/usb/hso.o
text data bss dec hex filename
32196 592 9960 42748 a6fc drivers/net/usb/hso.o
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/solos-pci.c')
0 files changed, 0 insertions, 0 deletions