All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shailendra Verma <shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Alexandre Courbot
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	p.shailesh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	Shailendra Verma
	<shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Shailendra Verma
	<shailendra.capricorn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 10:23:45 +0530	[thread overview]
Message-ID: <1485752025-29465-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170130045353epcas2p198210c8758d8a9d35fbfcfd8d24cc072@epcas2p1.samsung.com

of_match_device could return NULL, and so can cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 drivers/gpu/drm/tegra/sor.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 74d0540..34f032f 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -2540,6 +2540,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
 	int err;
 
 	match = of_match_device(tegra_sor_of_match, &pdev->dev);
+	if (!match) {
+		dev_err(&pdev->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
 
 	sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL);
 	if (!sor)
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
From: Shailendra Verma <shailendra.v@samsung.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	David Airlie <airlied@linux.ie>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, p.shailesh@samsung.com,
	ashish.kalra@samsung.com,
	Shailendra Verma <shailendra.v@samsung.com>,
	Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 10:23:45 +0530	[thread overview]
Message-ID: <1485752025-29465-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170130045353epcas2p198210c8758d8a9d35fbfcfd8d24cc072@epcas2p1.samsung.com

of_match_device could return NULL, and so can cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/gpu/drm/tegra/sor.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 74d0540..34f032f 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -2540,6 +2540,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
 	int err;
 
 	match = of_match_device(tegra_sor_of_match, &pdev->dev);
+	if (!match) {
+		dev_err(&pdev->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
 
 	sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL);
 	if (!sor)
-- 
1.7.9.5

       reply	other threads:[~2017-01-30  4:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170130045353epcas2p198210c8758d8a9d35fbfcfd8d24cc072@epcas2p1.samsung.com>
2017-01-30  4:53 ` Shailendra Verma [this message]
2017-01-30  4:53   ` [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence Shailendra Verma
     [not found]   ` <1485752025-29465-1-git-send-email-shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-01-30  7:11     ` Thierry Reding
2017-01-30  7:11       ` Thierry Reding

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=1485752025-29465-1-git-send-email-shailendra.v@samsung.com \
    --to=shailendra.v-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=p.shailesh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=shailendra.capricorn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.