Skip to content

Commit 36b07d1

Browse files
juhosglinvjw
authored andcommitted
ath9k: check pdata variable before dereferencing it
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent e576def commit 36b07d1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/wireless/ath/ath9k

‎drivers/net/wireless/ath/ath9k/init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
633633
ath_read_cachesize(common, &csz);
634634
common->cachelsz = csz << 2; /* convert to bytes */
635635

636-
if (pdata->eeprom_name) {
636+
if (pdata && pdata->eeprom_name) {
637637
ret = ath9k_eeprom_request(sc, pdata->eeprom_name);
638638
if (ret)
639639
goto err_eeprom;

0 commit comments

Comments
 (0)