public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: jejb@parisc-linux.org, deller@gmx.de,
	linux-parisc@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] video : fbdev : stifb :- Handle return NULL error from ioremap_nocache.
Date: Mon, 30 Jan 2017 15:59:22 +0000	[thread overview]
Message-ID: <1759269.Z5Z5RrJiUP@amdc3058> (raw)
In-Reply-To: <1484734911-5299-1-git-send-email-arvind.yadav.cs@gmail.com>


Hi,

On Wednesday, January 18, 2017 03:51:51 PM Arvind Yadav wrote:
> Here, If ioremap_nocache 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 <arvind.yadav.cs@gmail.com>

Thanks, I queued your patch with some minor changes for 4.11
(you can see the final version of the patch below).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


From: Arvind Yadav <arvind.yadav.cs@gmail.com>
Subject: [PATCH v1] video: fbdev: stifb: handle NULL return value from ioremap_nocache

Add missing error check for ioremap_nocache() failure
(prevents NULL pointer dereference on error).

Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
[b.zolnierkie: minor fixes]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/video/fbdev/stifb.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: b/drivers/video/fbdev/stifb.c
=================================--- a/drivers/video/fbdev/stifb.c	2017-01-30 16:55:15.766435453 +0100
+++ b/drivers/video/fbdev/stifb.c	2017-01-30 16:55:15.750435453 +0100
@@ -1294,6 +1294,10 @@ static int __init stifb_init_fb(struct s
 	strcpy(fix->id, "stifb");
 	info->fbops = &stifb_ops;
 	info->screen_base = ioremap_nocache(REGION_BASE(fb,1), fix->smem_len);
+	if (!info->screen_base) {
+		printk(KERN_ERR "stifb: failed to map memory\n");
+		goto out_err0;
+	}
 	info->screen_size = fix->smem_len;
 	info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA;
 	info->pseudo_palette = &fb->pseudo_palette;


      reply	other threads:[~2017-01-30 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170118102229epcas1p21c74a99299ee919a3f2d28ad435b7ca7@epcas1p2.samsung.com>
2017-01-18 10:33 ` [PATCH v1] video : fbdev : stifb :- Handle return NULL error from ioremap_nocache Arvind Yadav
2017-01-30 15:59   ` Bartlomiej Zolnierkiewicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1759269.Z5Z5RrJiUP@amdc3058 \
    --to=b.zolnierkie@samsung.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=deller@gmx.de \
    --cc=jejb@parisc-linux.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox