Hello Geliang Tang,

The patch e280d71bea18: "staging: rtl8723au: use
list_for_each_entry*()" from Feb 18, 2016, leads to the following
static checker warning:

        drivers/staging/rtl8723au/core/rtw_sta_mgt.c:365 rtw_get_stainfo23a()
        error: potential NULL dereference 'psta'.

drivers/staging/rtl8723au/core/rtw_sta_mgt.c
   363          spin_lock_bh(&pstapriv->sta_hash_lock);
   364          phead = &pstapriv->sta_hash[index];
   365          list_for_each_entry(psta, phead, hash_list) {
   366                  /*  if found the matched address */
   367                  if (ether_addr_equal(psta->hwaddr, addr))
   368                          break;
   369  
   370                  psta = NULL;
                        ^^^^^^^^^^^
This leads to a NULL dereference if we don't the address is not first
in the list.

   371          }
   372          spin_unlock_bh(&pstapriv->sta_hash_lock);
   373          return psta;
   374  }

regards,
dan carpenter
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to