Skip to contentSkip to conversation

Staging: rtl8192e prohibit deferencing of NULL pointer

PATCH Superseded Andreas Platschek 3 participants 3 messages Jun 18, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8192e prohibit deferencing of NULL pointer

If ieee = NULL we jump to rx_dropped. Therefore we have to check again, if ieee != NULL before we use it.

---
 drivers/staging/rtl8192e/rtllib_rx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8192e/rtllib_rx.c
index 60de54c..badf6e2 100644

drivers/staging/rtl8192e/rtllib_rx.c +0 -0
@@ -1496,7 +1496,9 @@ int rtllib_rx(struct rtllib_device *ieee, struct

sk_buff *skb,

     return ret;

rx_dropped:
- ieee->stats.rx_dropped++;
+ if (ieee != NULL) {
+ ieee->stats.rx_dropped++;
+ }

     return 0;

}
EXPORT_SYMBOL(rtllib_rx);

Signature · 1 line
1.7.10.4
#1 lore raw

Review

Quoted 7 lines · Andreas Platschek

rx_dropped:

(quoted diff) +3 -1
-    ieee->stats.rx_dropped++;
+    if (ieee != NULL) {
+        ieee->stats.rx_dropped++;
+    }
     return 0;

Style nit: don't use braces around a single statement.

Tina

#2 lore raw
In reply to Andreas Platschek
Quoted 2 lines · Andreas Platschek

If ieee = NULL we jump to rx_dropped. Therefore we have to check again, if ieee != NULL before we use it.

Take a look at the caller as well. It doesn't check ieee for NULL so probably this can never be NULL. How would that make sense if ieee were NULL?

Also the patch doesn't apply. Read Documentation/email-clients.txt

regards,
dan carpenter