diff options
author | Anton Vasilyev <vasilyev@ispras.ru> | 2018-07-27 16:59:29 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-07-30 09:41:04 +0100 |
commit | 4f919ca2bf6da826ba1a4316e1b8e9c94e5dbeb2 (patch) | |
tree | 06ab96dce6a71e22f307593498fbb084e00d7ed7 /drivers | |
parent | 6c0b319c0306accd92dc1601f8bf42adc147d4bf (diff) | |
download | linux-4f919ca2bf6da826ba1a4316e1b8e9c94e5dbeb2.tar.bz2 |
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@ispras.ru>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/tps65217-regulator.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |