wireless: potential null deref in p54spi.c
PATCH 1/1 wireless: potential null deref in p54spi.c
We can't use dev_err() becuase "priv" is NULL.
Found by smatch (http://repo.or.cz/w/smatch.git).
regards,
dan carpenter
drivers/net/wireless/p54/p54spi.c +1 -1
@@ -635,7 +635,7 @@ hw =p54_init_common (sizeof (*priv));if (!hw) { -dev_err (&priv->spi->dev,"could not alloc ieee80211_hw" ); +printk (KERN_ERR "could not alloc ieee80211_hw" );return -ENOMEM ; }
PATCH v2 1/1 p54spi: fix potential null deref in p54spi.c
From: Dan Carpenter <[email protected]>
Fix a potential NULL dereference bug during
error handling in p54spi_probe.
This bug was discovered by smatch:
(http://repo.or.cz/w/smatch.git).
---
Quoted 1 line · On Sunday 19 July 2009 13:53:57 Dan Carpenter wrote:
We can't use
dev_err()becuase "priv" is NULL.
yep, but that's my fault and not Micheal's.
Quoted 3 lines
Found by smatch (http://repo.or.cz/w/smatch.git).
regards,
dan carpenter
what about this alternative?
it retains the dev_err by simply moving to the spi_device *spi which comes from spi-subsystem and is initialized?
Regards,
Chr
---
drivers/net/wireless/p54/p54spi.c +1 -1
@@ -600,7 +600,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) hw =p54_init_common (sizeof (*priv));if (!hw) { -dev_err (&priv->spi->dev,"could not alloc ieee80211_hw" ); +dev_err (&spi->dev,"could not alloc ieee80211_hw" );return -ENOMEM ; }
Re: [PATCH v2] p54spi: fix potential null deref in p54spi.c
Great.
regards,
dan carpenter
Quoted 44 lines · Christian Lamparter
From: Dan Carpenter <[email protected]>
Fix a potential NULL dereference bug during
error handling inp54spi_probe.This bug was discovered by smatch:
(http://repo.or.cz/w/smatch.git).Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Christian Lamparter <[email protected]>---
Quoted 1 line · On Sunday 19 July 2009 13:53:57 Dan Carpenter wrote:
We can't use
dev_err()becuase "priv" is NULL.yep, but that's my fault and not Micheal's.
Quoted 3 lines
Found by smatch (http://repo.or.cz/w/smatch.git).
regards,
dan carpenterwhat about this alternative?
it retains thedev_errby simply moving to thespi_device*spi which comes from spi-subsystem and is initialized?Regards,
Chr
---drivers/net/wireless/p54/p54spi.c +1
-1@@ -600,7 +600,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) hw =p54_init_common (sizeof (*priv));if (!hw) { -dev_err (&priv->spi->dev,"could not alloc ieee80211_hw" ); +dev_err (&spi->dev,"could not alloc ieee80211_hw" );return -ENOMEM ; }