V4L/DVB (13017): gspca: kmalloc failure ignored in sd_start()
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 18 Sep 2009 23:33:27 +0000 (20:33 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 19 Sep 2009 03:53:30 +0000 (00:53 -0300)
Prevent NULL dereference if kmalloc() fails.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/jeilinj.c

index dbfa3ed..a11c97e 100644 (file)
@@ -312,6 +312,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
 
        /* create the JPEG header */
        dev->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
+       if (dev->jpeg_hdr == NULL)
+               return -ENOMEM;
        jpeg_define(dev->jpeg_hdr, gspca_dev->height, gspca_dev->width,
                        0x21);          /* JPEG 422 */
        jpeg_set_qual(dev->jpeg_hdr, dev->quality);