All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shailendra Verma <shailendra.v@samsung.com>
To: Rakesh Iyer <riyer@nvidia.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-input@vger.kernel.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>
Cc: vidushi.koul@samsung.com
Subject: [PATCH] Input: tegra-kbc - Fix possible NULL derefrence.
Date: Fri, 27 Jan 2017 16:12:36 +0530	[thread overview]
Message-ID: <1485513756-1854-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170127104250epcas1p4cf918f7e98f557ae65136f027f7556f1@epcas1p4.samsung.com

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

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/input/keyboard/tegra-kbc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index 0c07e10..1f213ba 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -617,6 +617,11 @@ static int tegra_kbc_probe(struct platform_device *pdev)
 	const struct of_device_id *match;
 
 	match = of_match_device(tegra_kbc_of_match, &pdev->dev);
+
+	if (!match) {
+		dev_err(&pdev->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
 
 	kbc = devm_kzalloc(&pdev->dev, sizeof(*kbc), GFP_KERNEL);
 	if (!kbc) {
-- 
1.7.9.5

       reply	other threads:[~2017-01-27 10:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170127104250epcas1p4cf918f7e98f557ae65136f027f7556f1@epcas1p4.samsung.com>
2017-01-27 10:42 ` Shailendra Verma [this message]
2017-01-27 10:54   ` [PATCH] Input: tegra-kbc - Fix possible NULL derefrence 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=1485513756-1854-1-git-send-email-shailendra.v@samsung.com \
    --to=shailendra.v@samsung.com \
    --cc=ashish.kalra@samsung.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.shailesh@samsung.com \
    --cc=riyer@nvidia.com \
    --cc=shailendra.capricorn@gmail.com \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    --cc=vidushi.koul@samsung.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 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.