V4L/DVB: dvb-usb: gp8psk, fix potential null derefernce
authorJiri Slaby <jslaby@suse.cz>
Tue, 27 Apr 2010 21:11:20 +0000 (18:11 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:58:33 +0000 (12:58 -0300)
Stanse found that in gp8psk_load_bcm4500fw there is missing a check for
return value of kmalloc. Add one and bail out appropriatelly.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/gp8psk.c

index afb444db43ad971df82b810ad09485cefc5c8a9b..45106ac4967403b83b60589f9cfe1b7e0497c739 100644 (file)
@@ -105,6 +105,10 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d)
 
        ptr = fw->data;
        buf = kmalloc(64, GFP_KERNEL | GFP_DMA);
+       if (!buf) {
+               ret = -ENOMEM;
+               goto out_rel_fw;
+       }
 
        while (ptr[0] != 0xff) {
                u16 buflen = ptr[0] + 4;