linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: benjamin.gaignard@linaro.org, vincent.abriou@st.com, airlied@linux.ie
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [v1] gpu: drm: sti: sti_vtac:- Handle return NULL error from devm_ioremap_nocache
Date: Wed, 21 Dec 2016 10:52:35 +0530	[thread overview]
Message-ID: <1482297755-4620-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)

Here, If devm_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>
---
 drivers/gpu/drm/sti/sti_vtac.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c
index cf7fe8a..dd749e9 100644
--- a/drivers/gpu/drm/sti/sti_vtac.c
+++ b/drivers/gpu/drm/sti/sti_vtac.c
@@ -191,6 +191,10 @@ static int sti_vtac_probe(struct platform_device *pdev)
 	if (res) {
 		vtac->phy_regs = devm_ioremap_nocache(dev, res->start,
 						 resource_size(res));
+			if (!vtac->phy_regs) {
+				DRM_ERROR("failed to remap I/O memory\n");
+				return -ENOMEM;
+			}
 		sti_vtac_tx_set_config(vtac);
 	} else {
 
-- 
1.7.9.5

             reply	other threads:[~2016-12-21  5:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21  5:22 Arvind Yadav [this message]
2017-01-04  9:31 ` [v1] gpu: drm: sti: sti_vtac:- Handle return NULL error from devm_ioremap_nocache Vincent ABRIOU

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=1482297755-4620-1-git-send-email-arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=airlied@linux.ie \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vincent.abriou@st.com \
    /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;
as well as URLs for NNTP newsgroup(s).