]> Git Repo - linux.git/commitdiff
ath9k: check pdata variable before dereferencing it
authorGabor Juhos <[email protected]>
Mon, 10 Dec 2012 23:06:41 +0000 (00:06 +0100)
committerJohn W. Linville <[email protected]>
Tue, 11 Dec 2012 21:00:39 +0000 (16:00 -0500)
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 <[email protected]>
Signed-off-by: Gabor Juhos <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
drivers/net/wireless/ath/ath9k/init.c

index 27703a5e48d66ac2fd165aadb1dd1dbcf9276f25..f69ef5d48c7b96119cb516259f41f2256f150747 100644 (file)
@@ -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;
This page took 0.061211 seconds and 4 git commands to generate.