Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754750AbcLNCXW (ORCPT ); Tue, 13 Dec 2016 21:23:22 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:33525 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754587AbcLNCXV (ORCPT ); Tue, 13 Dec 2016 21:23:21 -0500 MIME-Version: 1.0 In-Reply-To: <1481617252-8298-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1481617252-8298-1-git-send-email-arvind.yadav.cs@gmail.com> From: Yuasa Yoichi Date: Wed, 14 Dec 2016 11:23:07 +0900 X-Google-Sender-Auth: bN9jbxR95DFBcwlqla-dnn_7XgY Message-ID: Subject: Re: [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap To: Arvind Yadav Cc: tomi.valkeinen@ti.com, ralf@linux-mips.org, paul.burton@imgtec.com, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1410 Lines: 39 Hi Arvind, Thank you for fixing it. Acked-by: Yoichi Yuasa 2016-12-13 17:20 GMT+09:00 Arvind Yadav : > Here, If devm_ioremap will fail. It will return NULL. > Kernel can run into a NULL-pointer dereference. > This error check will avoid NULL pointer dereference. > > Signed-off-by: Arvind Yadav > --- > drivers/video/fbdev/cobalt_lcdfb.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c > index 2d3b691..038ac69 100644 > --- a/drivers/video/fbdev/cobalt_lcdfb.c > +++ b/drivers/video/fbdev/cobalt_lcdfb.c > @@ -308,6 +308,11 @@ static int cobalt_lcdfb_probe(struct platform_device *dev) > info->screen_size = resource_size(res); > info->screen_base = devm_ioremap(&dev->dev, res->start, > info->screen_size); > + if (!info->screen_base) { > + framebuffer_release(info); > + return -ENOMEM; > + } > + > info->fbops = &cobalt_lcd_fbops; > info->fix = cobalt_lcdfb_fix; > info->fix.smem_start = res->start; > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html