* [patch] wireless: potential null deref in p54spi.c
@ 2009-07-19 11:53 Dan Carpenter
2009-07-19 19:26 ` [PATCH v2] p54spi: fix " Christian Lamparter
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2009-07-19 11:53 UTC (permalink / raw)
To: flamingice; +Cc: linux-wireless
We can't use dev_err() becuase "priv" is NULL.
Found by smatch (http://repo.or.cz/w/smatch.git).
regards,
dan carpenter
Signed-off-by: Dan Carpenter <error27@gmail.com>
--- orig/drivers/net/wireless/p54/p54spi.c 2009-07-17 16:04:20.000000000 +0300
+++ new/drivers/net/wireless/p54/p54spi.c 2009-07-17 16:05:28.000000000 +0300
@@ -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;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] p54spi: fix potential null deref in p54spi.c
2009-07-19 11:53 [patch] wireless: potential null deref in p54spi.c Dan Carpenter
@ 2009-07-19 19:26 ` Christian Lamparter
2009-07-22 14:40 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Christian Lamparter @ 2009-07-19 19:26 UTC (permalink / raw)
To: linux-wireless; +Cc: Max Filippov, Dan Carpenter, John W. Linville
From: Dan Carpenter <error27@gmail.com>
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).
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@web.de>
---
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.
> 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
---
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index d5f181a..eef5329 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] p54spi: fix potential null deref in p54spi.c
2009-07-19 19:26 ` [PATCH v2] p54spi: fix " Christian Lamparter
@ 2009-07-22 14:40 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2009-07-22 14:40 UTC (permalink / raw)
To: Christian Lamparter; +Cc: linux-wireless, Max Filippov, John W. Linville
Great.
Acked-by: Dan Carpenter <error27@gmail.com>
regards,
dan carpenter
On 7/19/09, Christian Lamparter <chunkeey@web.de> wrote:
> From: Dan Carpenter <error27@gmail.com>
>
> 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).
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Christian Lamparter <chunkeey@web.de>
> ---
> 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.
>
>> 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
> ---
> diff --git a/drivers/net/wireless/p54/p54spi.c
> b/drivers/net/wireless/p54/p54spi.c
> index d5f181a..eef5329 100644
> --- a/drivers/net/wireless/p54/p54spi.c
> +++ b/drivers/net/wireless/p54/p54spi.c
> @@ -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;
> }
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-22 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-19 11:53 [patch] wireless: potential null deref in p54spi.c Dan Carpenter
2009-07-19 19:26 ` [PATCH v2] p54spi: fix " Christian Lamparter
2009-07-22 14:40 ` Dan Carpenter
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).