linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: fix a potential NULL pointer dereference
@ 2019-03-09  4:53 Kangjie Lu
  2019-03-09 18:32 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-09  4:53 UTC (permalink / raw)
  To: kjlu
  Cc: linux-arm-kernel, Lars-Peter Clausen, Pengutronix Kernel Team,
	linux-iio, Fabio Estevam, Sascha Hauer, pakki001, linux-kernel,
	NXP Linux Team, Peter Meerwald-Stadler, Hartmut Knaack, Shawn Guo,
	Jonathan Cameron

devm_iio_trigger_alloc may fail and return NULL. The fix returns
ENOMEM when it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/iio/adc/mxs-lradc-adc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
index c627513d9f0f..5384472b6c4d 100644
--- a/drivers/iio/adc/mxs-lradc-adc.c
+++ b/drivers/iio/adc/mxs-lradc-adc.c
@@ -465,6 +465,8 @@ static int mxs_lradc_adc_trigger_init(struct iio_dev *iio)
 
 	trig = devm_iio_trigger_alloc(&iio->dev, "%s-dev%i", iio->name,
 				      iio->id);
+	if (!trig)
+		return -ENOMEM;
 
 	trig->dev.parent = adc->dev;
 	iio_trigger_set_drvdata(trig, iio);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-09 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-09  4:53 [PATCH] iio: adc: fix a potential NULL pointer dereference Kangjie Lu
2019-03-09 18:32 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).