[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1485513756-1854-1-git-send-email-shailendra.v@samsung.com>
Date: Fri, 27 Jan 2017 16:12:36 +0530
From: Shailendra Verma <shailendra.v@...sung.com>
To: Rakesh Iyer <riyer@...dia.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Stephen Warren <swarren@...dotorg.org>,
Thierry Reding <thierry.reding@...il.com>,
Alexandre Courbot <gnurou@...il.com>,
linux-input@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org, p.shailesh@...sung.com,
ashish.kalra@...sung.com,
Shailendra Verma <shailendra.v@...sung.com>,
Shailendra Verma <shailendra.capricorn@...il.com>
Cc: vidushi.koul@...sung.com
Subject: [PATCH] Input: tegra-kbc - Fix possible NULL derefrence.
of_match_device could return NULL, and so cause a NULL pointer
dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@...sung.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
Powered by blists - more mailing lists