linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: check pdata variable before dereferencing it
@ 2012-12-10 23:06 Gabor Juhos
  0 siblings, 0 replies; 3+ messages in thread
From: Gabor Juhos @ 2012-12-10 23:06 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Dan Carpenter, Gabor Juhos

Due to my recent commit (ath9k: allow to load EEPROM
content via firmware API) smatch complains about that
the 'pdata' variable in 'ath9k_hw_init' can be NULL
and it is dereferenced before checking that. That is
absolutely correct.

Check the 'pdata' variable before using it to avoid
a NULL pointer dereference.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 27703a5..f69ef5d 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -633,7 +633,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 	ath_read_cachesize(common, &csz);
 	common->cachelsz = csz << 2; /* convert to bytes */
 
-	if (pdata->eeprom_name) {
+	if (pdata && pdata->eeprom_name) {
 		ret = ath9k_eeprom_request(sc, pdata->eeprom_name);
 		if (ret)
 			goto err_eeprom;
-- 
1.7.10


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

* [PATCH] ath9k: check pdata variable before dereferencing it
@ 2012-12-11 17:25 Gabor Juhos
  2012-12-11 17:26 ` Gabor Juhos
  0 siblings, 1 reply; 3+ messages in thread
From: Gabor Juhos @ 2012-12-11 17:25 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-wireless, Johannes Berg, Christian Lamparter, Gabor Juhos

Due to my recent commit (ath9k: allow to load EEPROM
content via firmware API) smatch complains about that
the 'pdata' variable in 'ath9k_hw_init' can be NULL
and it is dereferenced before checking that. That is
absolutely correct.

Check the 'pdata' variable before using it to avoid
a NULL pointer dereference.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 27703a5..f69ef5d 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -633,7 +633,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 	ath_read_cachesize(common, &csz);
 	common->cachelsz = csz << 2; /* convert to bytes */
 
-	if (pdata->eeprom_name) {
+	if (pdata && pdata->eeprom_name) {
 		ret = ath9k_eeprom_request(sc, pdata->eeprom_name);
 		if (ret)
 			goto err_eeprom;
-- 
1.7.10


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

* Re: [PATCH] ath9k: check pdata variable before dereferencing it
  2012-12-11 17:25 [PATCH] ath9k: check pdata variable before dereferencing it Gabor Juhos
@ 2012-12-11 17:26 ` Gabor Juhos
  0 siblings, 0 replies; 3+ messages in thread
From: Gabor Juhos @ 2012-12-11 17:26 UTC (permalink / raw)
  To: Gabor Juhos
  Cc: John W. Linville, linux-wireless, Johannes Berg,
	Christian Lamparter

2012.12.11. 18:25 keltezéssel, Gabor Juhos írta:
> Due to my recent commit (ath9k: allow to load EEPROM
> content via firmware API) smatch complains about that
> the 'pdata' variable in 'ath9k_hw_init' can be NULL
> and it is dereferenced before checking that. That is
> absolutely correct.
> 
> Check the 'pdata' variable before using it to avoid
> a NULL pointer dereference.

Oops, sent an old patch again instead of the rt2x00 one. Sorry.

-Gabor

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

end of thread, other threads:[~2012-12-11 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-11 17:25 [PATCH] ath9k: check pdata variable before dereferencing it Gabor Juhos
2012-12-11 17:26 ` Gabor Juhos
  -- strict thread matches above, loose matches on Subject: below --
2012-12-10 23:06 Gabor Juhos

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