staging: fbtft: Fix potential null dereference
authorRavindran, Madhusudhanan (M.) <mravindr@visteon.com>
Mon, 16 Mar 2015 15:36:41 +0000 (15:36 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Mar 2015 12:54:50 +0000 (13:54 +0100)
This error is found by smatch tool.

Signed-off-by: Madhusudhanan Ravindran <mravindr@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fb_agm1264k-fl.c

index 578fdbe352d1e5d9580f7a14c234ecfe12e1e5c0..939b7b963043d4d0a1558a896dcb6738d71b39e6 100644 (file)
@@ -282,6 +282,9 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
        signed short *convert_buf = kmalloc(par->info->var.xres *
                par->info->var.yres * sizeof(signed short), GFP_NOIO);
 
+       if (!convert_buf)
+               return -ENOMEM;
+
        fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__);
 
        /* converting to grayscale16 */