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

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


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

* [PATCH] iio: adc: fix a potential NULL pointer dereference
@ 2019-03-09  4:53 ` Kangjie Lu
  0 siblings, 0 replies; 4+ 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] 4+ messages in thread

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

On Fri,  8 Mar 2019 22:53:55 -0600
Kangjie Lu <kjlu@umn.edu> wrote:

> devm_iio_trigger_alloc may fail and return NULL. The fix returns
> ENOMEM when it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Seems obviously correct to me.  As it's been there a 'while'
I'm not going to rush it in however. This can wait for the next
merge window.

Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  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);


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

* Re: [PATCH] iio: adc: fix a potential NULL pointer dereference
@ 2019-03-09 18:32   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2019-03-09 18:32 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: 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, linux-arm-kernel

On Fri,  8 Mar 2019 22:53:55 -0600
Kangjie Lu <kjlu@umn.edu> wrote:

> devm_iio_trigger_alloc may fail and return NULL. The fix returns
> ENOMEM when it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Seems obviously correct to me.  As it's been there a 'while'
I'm not going to rush it in however. This can wait for the next
merge window.

Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  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);


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

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

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

Thread overview: 4+ 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  4:53 ` Kangjie Lu
2019-03-09 18:32 ` Jonathan Cameron
2019-03-09 18:32   ` Jonathan Cameron

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.