public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer
@ 2014-06-18 18:16 Andreas Platschek
  2014-06-18 18:33 ` Valentina Manea
  2014-06-18 18:48 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Platschek @ 2014-06-18 18:16 UTC (permalink / raw)
  To: kernel-janitors

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

Signed-off-by: Andreas Platschek <platschek@ict.tuwien.ac.at>
---
 drivers/staging/rtl8192e/rtllib_rx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c
b/drivers/staging/rtl8192e/rtllib_rx.c
index 60de54c..badf6e2 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer
  2014-06-18 18:16 [PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer Andreas Platschek
@ 2014-06-18 18:33 ` Valentina Manea
  2014-06-18 18:48 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Valentina Manea @ 2014-06-18 18:33 UTC (permalink / raw)
  To: kernel-janitors

On Wed, Jun 18, 2014 at 11:16 AM, Andreas Platschek
<platschek@ict.tuwien.ac.at> wrote:
>
>   rx_dropped:
> -    ieee->stats.rx_dropped++;
> +    if (ieee != NULL) {
> +        ieee->stats.rx_dropped++;
> +    }
>      return 0;

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

Tina

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer
  2014-06-18 18:16 [PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer Andreas Platschek
  2014-06-18 18:33 ` Valentina Manea
@ 2014-06-18 18:48 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-06-18 18:48 UTC (permalink / raw)
  To: kernel-janitors

On Wed, Jun 18, 2014 at 06:16:09PM +0000, Andreas Platschek wrote:
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-18 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 18:16 [PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer Andreas Platschek
2014-06-18 18:33 ` Valentina Manea
2014-06-18 18:48 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox