From 6a938a8cef9abad2ae13e6a48329f5119930b0d6 Mon Sep 17 00:00:00 2001 From: "Ravindran, Madhusudhanan (M.)" Date: Mon, 16 Mar 2015 15:36:41 +0000 Subject: [PATCH] staging: fbtft: Fix potential null dereference This error is found by smatch tool. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_agm1264k-fl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 578fdbe352d1..939b7b963043 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -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 */ -- 2.39.5