linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Misc: eeprom - Fix possible NULL derefrence.
       [not found] <CGME20170127111239epcas2p41579f86bf18989151d77d7edd39dee9e@epcas2p4.samsung.com>
@ 2017-01-27 11:12 ` Shailendra Verma
  2017-01-30 19:37   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Cory Tusar, Vladimir Zapolskiy,
	Srinivas Kandagatla, Andrew Lunn, linux-kernel, p.shailesh,
	ashish.kalra, Shailendra Verma, Shailendra Verma

of_match_device could return NULL, and so can cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/misc/eeprom/eeprom_93xx46.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index 94cc035..6555975 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -381,6 +381,11 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi)
 	enum of_gpio_flags of_flags;
 	int ret;
 
+	if (!of_id) {
+		dev_err(&spi->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
+
 	pd = devm_kzalloc(&spi->dev, sizeof(*pd), GFP_KERNEL);
 	if (!pd)
 		return -ENOMEM;
-- 
1.7.9.5

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

* Re: [PATCH] Misc: eeprom - Fix possible NULL derefrence.
  2017-01-27 11:12 ` [PATCH] Misc: eeprom - Fix possible NULL derefrence Shailendra Verma
@ 2017-01-30 19:37   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-30 19:37 UTC (permalink / raw)
  To: Shailendra Verma
  Cc: Cory Tusar, Vladimir Zapolskiy, Srinivas Kandagatla, Andrew Lunn,
	linux-kernel, p.shailesh, ashish.kalra, Shailendra Verma

On Fri, Jan 27, 2017 at 04:42:31PM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
> 
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
>  drivers/misc/eeprom/eeprom_93xx46.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
> index 94cc035..6555975 100644
> --- a/drivers/misc/eeprom/eeprom_93xx46.c
> +++ b/drivers/misc/eeprom/eeprom_93xx46.c
> @@ -381,6 +381,11 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi)
>  	enum of_gpio_flags of_flags;
>  	int ret;
>  
> +	if (!of_id) {
> +		dev_err(&spi->dev, "Error: No device match found\n");
> +		return -ENODEV;
> +	}
> +

Also dropped due to this not being possible.

greg k-h

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

end of thread, other threads:[~2017-01-30 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170127111239epcas2p41579f86bf18989151d77d7edd39dee9e@epcas2p4.samsung.com>
2017-01-27 11:12 ` [PATCH] Misc: eeprom - Fix possible NULL derefrence Shailendra Verma
2017-01-30 19:37   ` Greg Kroah-Hartman

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