V4L/DVB: videobuf: add missing checks for kzalloc returning NULL
authorPawel Osciak <p.osciak@samsung.com>
Mon, 22 Feb 2010 16:10:06 +0000 (13:10 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:11:03 +0000 (15:11 -0300)
Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/videobuf-dma-sg.c
drivers/media/video/videobuf-vmalloc.c

index fa78555b118bddc20948836e3d4fae5bd5a7e91a..fcd045e7a1c1e2ea90ca0ead71766e3e55e7a5b7 100644 (file)
@@ -418,6 +418,8 @@ static void *__videobuf_alloc(size_t size)
        struct videobuf_buffer *vb;
 
        vb = kzalloc(size+sizeof(*mem),GFP_KERNEL);
+       if (!vb)
+               return vb;
 
        mem = vb->priv = ((char *)vb)+size;
        mem->magic=MAGIC_SG_MEM;
index d6e6a28fb6b896e349f9396422d5ba67328528ab..136e09383c061ae5a630e6e56b46dc69ad68892c 100644 (file)
@@ -138,6 +138,8 @@ static void *__videobuf_alloc(size_t size)
        struct videobuf_buffer *vb;
 
        vb = kzalloc(size+sizeof(*mem),GFP_KERNEL);
+       if (!vb)
+               return vb;
 
        mem = vb->priv = ((char *)vb)+size;
        mem->magic=MAGIC_VMAL_MEM;