Fix a possible null pointer dereference, there is
otherwise a risk of a possible null pointer dereference.

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <rickard_strandqv...@spectrumdigital.se>
---
 drivers/staging/rtl8192u/r8192U_core.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index e031a25..922fd8b 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -963,6 +963,7 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, 
struct net_device *dev,
        memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
        tcb_desc->bTxEnableFwCalcDur = 1;
        skb_push(skb, priv->ieee80211->tx_headroom);
+       // cppcheck-suppress unreadVariable  CPPC_DONE
        ret = rtl8192_tx(dev, skb);
 
        spin_unlock_irqrestore(&priv->tx_lock, flags);
@@ -2530,6 +2531,7 @@ static short rtl8192_init(struct net_device *dev)
        memset(priv->txqueue_to_outpipemap, 0, 9);
 #ifdef PIPE12
        {
+               // cppcheck-suppress unreadVariable  CPPC_DONE
                int i = 0;
                u8 queuetopipe[] = {3, 2, 1, 0, 4, 8, 7, 6, 5};
                memcpy(priv->txqueue_to_outpipemap, queuetopipe, 9);
@@ -3404,6 +3406,7 @@ void rtl8192_commit(struct net_device *dev)
        ieee80211_softmac_stop_protocol(priv->ieee80211);
 
        rtl8192_rtx_disable(dev);
+       // cppcheck-suppress unreadVariable  CPPC_DONE
        reset_status = _rtl8192_up(dev);
 
 }
@@ -3721,6 +3724,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv 
*priv, u8 *buffer,
        unsigned int frag, seq;
        hdr = (struct ieee80211_hdr_3addr *)buffer;
        sc = le16_to_cpu(hdr->seq_ctl);
+       // cppcheck-suppress unreadVariable  CPPC_DONE
        frag = WLAN_GET_SEQ_FRAG(sc);
        seq = WLAN_GET_SEQ_SEQ(sc);
        //cosa add 04292008 to record the sequence number
@@ -4476,11 +4480,11 @@ static void query_rxdesc_status(struct sk_buff *skb,
 
        /* for debug 2008.5.29 */
 
-       //added by vivi, for MP, 20080108
-       stats->RxIs40MHzPacket = driver_info->BW;
-       if (stats->RxDrvInfoSize != 0)
+       if (driver_info && stats->RxDrvInfoSize != 0) {
+               //added by vivi, for MP, 20080108
+               stats->RxIs40MHzPacket = driver_info->BW;
                TranslateRxSignalStuff819xUsb(skb, stats, driver_info);
-
+       }
 }
 
 static void rtl8192_rx_nomal(struct sk_buff *skb)
@@ -4544,7 +4548,9 @@ static void rtl819xusb_process_received_packet(struct 
net_device *dev,
        // Get shifted bytes of Starting address of 802.11 header. 2006.09.28, 
by Emily
        //porting by amy 080508
        pstats->virtual_address += get_rxpacket_shiftbytes_819xusb(pstats);
+       // cppcheck-suppress unreadVariable  CPPC_TODO
        frame = pstats->virtual_address;
+       // cppcheck-suppress unreadVariable  CPPC_TODO
        frame_len = pstats->packetlength;
 #ifdef TODO    // by amy about HCT
        if (!Adapter->bInHctTest)
-- 
1.7.10.4

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

Reply via email to