[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20180727135929.13406-1-vasilyev@ispras.ru>
Date: Fri, 27 Jul 2018 16:59:29 +0300
From: Anton Vasilyev <vasilyev@...ras.ru>
To: Tony Lindgren <tony@...mide.com>
Cc: Anton Vasilyev <vasilyev@...ras.ru>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, linux-omap@...r.kernel.org,
linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org
Subject: [PATCH] regulator: tps65217: Fix NULL pointer dereference on probe
There is no check that tps->strobes is allocated successfully in
tps65217_regulator_probe().
The patch adds corresponding check.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Anton Vasilyev <vasilyev@...ras.ru>
---
drivers/regulator/tps65217-regulator.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
index fc12badf3805..d84fab616abf 100644
--- a/drivers/regulator/tps65217-regulator.c
+++ b/drivers/regulator/tps65217-regulator.c
@@ -232,6 +232,8 @@ static int tps65217_regulator_probe(struct platform_device *pdev)
tps->strobes = devm_kcalloc(&pdev->dev,
TPS65217_NUM_REGULATOR, sizeof(u8),
GFP_KERNEL);
+ if (!tps->strobes)
+ return -ENOMEM;
platform_set_drvdata(pdev, tps);
--
2.18.0
Powered by blists - more mailing lists