[PATCH] staging: lustre: check length of char array

2014-05-19 Thread Andreas Platschek
This fixes the following sparse error:

drivers/staging/lustre/lustre/obdclass/llog_ioctl.c:388:39: error: incompatible 
types for operation (>)
drivers/staging/lustre/lustre/obdclass/llog_ioctl.c:388:39:left side has 
type char *ioc_inlbuf2
drivers/staging/lustre/lustre/obdclass/llog_ioctl.c:388:39:right side has 
type int

Signed-off-by: Andreas Platschek 
---
 drivers/staging/lustre/lustre/obdclass/llog_ioctl.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c 
b/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
index da558a5..e192aab 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
@@ -385,7 +385,7 @@ int llog_ioctl(const struct lu_env *env, struct llog_ctxt 
*ctxt, int cmd,
GOTO(out_close, rc = -EINVAL);
}
 
-   if (data->ioc_inlbuf2 > 0) {
+   if (data->ioc_inllen2 > 0) {
/* remove indicate log from the catalog */
rc = str2logid(&plain, data->ioc_inlbuf2,
   data->ioc_inllen2);
-- 
1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8192e prohibit deferencing of NULL pointer

2014-06-18 Thread Andreas Platschek
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 
---
 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: rtl8192e prohibit deferencing of NULL pointer

2014-06-18 Thread Andreas Platschek
v2: removed braces from if statement

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 
---
 drivers/staging/rtl8192e/rtllib_rx.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c
b/drivers/staging/rtl8192e/rtllib_rx.c
index 60de54c..7258b17 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1496,7 +1496,8 @@ 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: rtl8192e prohibit deferencing of NULL pointer

2014-06-18 Thread Andreas Platschek
v2: removed braces from if statement

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 
---
 drivers/staging/rtl8192e/rtllib_rx.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c
b/drivers/staging/rtl8192e/rtllib_rx.c
index 60de54c..7258b17 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1496,7 +1496,8 @@ 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel