All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: tps65217: Fix NULL pointer dereference on probe
@ 2018-07-27 13:59 Anton Vasilyev
  0 siblings, 0 replies; only message in thread
From: Anton Vasilyev @ 2018-07-27 13:59 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Anton Vasilyev, Liam Girdwood, Mark Brown, linux-omap,
	linux-kernel, ldv-project

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@ispras.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-27 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 13:59 [PATCH] regulator: tps65217: Fix NULL pointer dereference on probe Anton Vasilyev

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.