Re: [PATCH 05/11] Staging: bcm: Replace ULONG with unsigned long in Adapter.h

2013-10-27 Thread Dan Carpenter
On Sat, Oct 26, 2013 at 02:15:14AM -0400, Kevin McKinney wrote:
> This patch replace "ULONG" with "unsigned
> long" in Adapter.h
> 
> Signed-off-by: Kevin McKinney 
> ---
>  drivers/staging/bcm/Adapter.h |   42 
> -
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h
> index eaf9532..4c9662b 100644
> --- a/drivers/staging/bcm/Adapter.h
> +++ b/drivers/staging/bcm/Adapter.h
> @@ -37,12 +37,12 @@ struct bcm_link_request {
>  
>  union bcm_ip_address {
>   struct {
> - ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address 
> Range */
> - ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask 
> Address Range */
> + unsigned long ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip 
> Address Range */

These aren't correct in the original code btw.  ipv4 addresses should
fit in a u32.  Also it's not clear how this address is used.

It's something to think about and maybe remove or fix in later patches.

regards,
dan carpenter

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


Re: [PATCH 04/11] Staging: bcm: Replace UCHAR with unsigned char in Adapter.h

2013-10-27 Thread Dan Carpenter
On Sat, Oct 26, 2013 at 02:15:13AM -0400, Kevin McKinney wrote:
> This patch replace "UCHAR" with "unsigned
> char" in Adapter.h

I feel like these should pretty much all be u8 instead of "unsigned
char".

regards,
dan carpenter

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


Re: [PATCH 2/2] Staging: vt6656: fix code indenting error in power.c

2013-10-27 Thread Greg Kroah-Hartman
On Thu, Oct 24, 2013 at 07:26:47AM +0200, Johannes Löthberg wrote:
> This patch fixes a code indentation error found by checkpatch.pl
> where a line was indented with spaces instead of tabs
> 
> Signed-off-by: Johannes Löthberg 
> ---
>  drivers/staging/vt6656/power.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
> index 3002061..a14a2bf 100644
> --- a/drivers/staging/vt6656/power.c
> +++ b/drivers/staging/vt6656/power.c
> @@ -268,7 +268,7 @@ int PSbSendNullPacket(struct vnt_private *pDevice)
>   + sizeof(struct vnt_tx_mgmt));
>  
>   flags = WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
> -WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL);
> + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL);

No, indent this line properly using tabs to where the spaces were,
that's the correct location.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:ktap:loader.c fix coding style

2013-10-27 Thread Gokulnath A
fixed the errors and warnings generated by
checkpatch.pl script.

Signed-off-by: Gokulnath A 
---
 drivers/staging/ktap/interpreter/loader.c | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ktap/interpreter/loader.c
b/drivers/staging/ktap/interpreter/loader.c
index 0da54d7..bd48714 100644
--- a/drivers/staging/ktap/interpreter/loader.c
+++ b/drivers/staging/ktap/interpreter/loader.c
@@ -43,11 +43,11 @@ struct load_state {
 do {\
 memcpy(dst, &S->buff[S->pos], size);\
 S->pos += size;\
-} while(0)
+} while (0)

 #define NEW_VECTOR(S, size)kp_malloc(S->ks, size)
-#define GET_CURRENT(S)&S->buff[S->pos]
-#define ADD_POS(S, size)S->pos += size
+#define GET_CURRENT(S)(&S->buff[S->pos])
+#define ADD_POS(S, size)(S->pos += size)


 static int load_function(struct load_state *S, ktap_proto *f);
@@ -101,7 +101,7 @@ static int load_code(struct load_state *S, ktap_proto *f)

 static int load_constants(struct load_state *S, ktap_proto *f)
 {
-int i,n;
+int i, n;

 n = READ_INT(S);

@@ -110,7 +110,7 @@ static int load_constants(struct load_state *S,
ktap_proto *f)
 for (i = 0; i < n; i++)
 setnilvalue(&f->k[i]);

-for (i=0; i < n; i++) {
+for (i = 0; i < n; i++) {
 ktap_value *o = &f->k[i];

 int t = READ_CHAR(S);
@@ -132,10 +132,9 @@ static int load_constants(struct load_state *S,
ktap_proto *f)
 setsvalue(o, READ_STRING(S));
 break;
 default:
-kp_error(S->ks, "ktap: load_constants: "
-"unknow ktap_value\n");
+kp_error(S->ks,
+"ktap: load_constants:unknow ktap_value\n");
 return -1;
-
 }
 }

@@ -156,7 +155,7 @@ static int load_constants(struct load_state *S,
ktap_proto *f)

 static int load_upvalues(struct load_state *S, ktap_proto *f)
 {
-int i,n;
+int i, n;

 n = READ_INT(S);
 f->upvalues = NEW_VECTOR(S, n * sizeof(ktap_upvaldesc));
@@ -175,7 +174,7 @@ static int load_upvalues(struct load_state *S,
ktap_proto *f)

 static int load_debuginfo(struct load_state *S, ktap_proto *f)
 {
-int i,n;
+int i, n;

 f->source = READ_STRING(S);
 n = READ_INT(S);
@@ -202,7 +201,7 @@ static int load_debuginfo(struct load_state *S,
ktap_proto *f)
 static int load_function(struct load_state *S, ktap_proto *f)
 {
 f->linedefined = READ_INT(S);
- f->lastlinedefined = READ_INT(S);
+f->lastlinedefined = READ_INT(S);
 f->numparams = READ_BYTE(S);
 f->is_vararg = READ_BYTE(S);
 f->maxstacksize = READ_BYTE(S);
@@ -224,8 +223,8 @@ static int load_function(struct load_state *S,
ktap_proto *f)

 #define N0KTAPC_HEADERSIZE
 #define N1(sizeof(KTAP_SIGNATURE) - sizeof(char))
-#define N2N1 + 2
-#define N3N2 + 6
+#define N2(N1 + 2)
+#define N3(N2 + 6)

 static int load_header(struct load_state *S)
 {
@@ -244,7 +243,7 @@ static int load_header(struct load_state *S)
 else if (memcmp(h, s, N3) != 0)
 error(S, "incompatible");
 else
-error(S,"corrupted");
+error(S, "corrupted");

 return -1;
 }
--
1.8.1.2
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:ktap:ktap.c: fix coding style

2013-10-27 Thread Gokulnath A
fixed the errors and warnings found by
checkpatch.pl script.

Signed-off-by: Gokulnath A 
---
 drivers/staging/ktap/interpreter/ktap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ktap/interpreter/ktap.c
b/drivers/staging/ktap/interpreter/ktap.c
index 18d8fc8..b84ebca 100644
--- a/drivers/staging/ktap/interpreter/ktap.c
+++ b/drivers/staging/ktap/interpreter/ktap.c
@@ -128,7 +128,7 @@ static int ktap_main(struct file *file, ktap_parm *parm)
 kp_final_exit(ks);

  out:
-atomic_dec(&kp_is_running);
+atomic_dec(&kp_is_running);
 return ret;
 }

@@ -157,7 +157,7 @@ static long ktap_ioctl(struct file *file, unsigned
int cmd, unsigned long arg)
 return -EINVAL;
 };

-return 0;
+return 0;
 }

 static const struct file_operations ktap_fops = {
--
1.8.1.2
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: lustre: lnet: Remove unnecessary spaces in lib-lnet.h

2013-10-27 Thread Lisa Nguyen
On Sat, Oct 26, 2013 at 8:37 PM, Greg KH  wrote:
> On Fri, Oct 25, 2013 at 01:22:52PM -0700, Lisa Nguyen wrote:
>> Remove spaces between function names and open parentheses to
>> meet kernel coding style and eliminate extra space warnings
>> generated by checkpatch.pl
>>
>> Signed-off-by: Lisa Nguyen 
>
> This series doesn't apply either, did I already apply it?

Yes, you've already applied it :)


> When resending patch series, please put a [RESEND] or [v2] or something
> so that I know to drop the previous one before I apply it.

I will keep that tip for future patches. Thanks!

> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] staging: lustre: Remove typedef and update cfs_hash_bucket struct

2013-10-27 Thread Lisa Nguyen
On Sat, Oct 26, 2013 at 8:36 PM, Greg KH  wrote:
> On Fri, Oct 25, 2013 at 01:20:18PM -0700, Lisa Nguyen wrote:
>> Remove typedef keyword and rename the cfs_hash_bucket_t struct to
>> cfs_hash_bucket in libcfs_hash.h. These changes resolve the
>> "Do not add new typedefs" warning generated by checkpatch.pl and
>> meet kernel coding style.
>>
>> The struct variables in hash.c are updated to reflect this change
>> as well.
>>
>> Signed-off-by: Lisa Nguyen 
>
> This patch doesn't apply at all, nor does this series, care to refresh
> it against my latest tree and resend it?
>

Yeah, I would except you already applied this patch series :)

> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:ktap:ktap.c: fix coding style

2013-10-27 Thread Gokulnath A
fixed the errors and warnings found by
checkpatch.pl script.

Signed-off-by: Gokulnath A 
---
 drivers/staging/ktap/interpreter/ktap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ktap/interpreter/ktap.c
b/drivers/staging/ktap/interpreter/ktap.c
index 18d8fc8..b84ebca 100644
--- a/drivers/staging/ktap/interpreter/ktap.c
+++ b/drivers/staging/ktap/interpreter/ktap.c
@@ -128,7 +128,7 @@ static int ktap_main(struct file *file, ktap_parm *parm)
 kp_final_exit(ks);

  out:
-atomic_dec(&kp_is_running);
+atomic_dec(&kp_is_running);
 return ret;
 }

@@ -157,7 +157,7 @@ static long ktap_ioctl(struct file *file, unsigned
int cmd, unsigned long arg)
 return -EINVAL;
 };

-return 0;
+return 0;
 }

 static const struct file_operations ktap_fops = {
--
1.8.1.2
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:ktap:loader.c fix coding style

2013-10-27 Thread Greg KH
On Mon, Oct 28, 2013 at 12:43:04AM +0530, Gokulnath A wrote:
> fixed the errors and warnings generated by
> checkpatch.pl script.
> 
> Signed-off-by: Gokulnath A 
> ---
>  drivers/staging/ktap/interpreter/loader.c | 27 +--
>  1 file changed, 13 insertions(+), 14 deletions(-)

This code just got deleted from the staging tree, so no need to clean it
up anymore, sorry.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2 v2] Staging: vt6656: fix code indenting error in power.c

2013-10-27 Thread Johannes Löthberg
This patch fixes a code indentation error found by checkpatch.pl
where a line was indented with spaces instead of tabs

Signed-off-by: Johannes Löthberg 
---
 drivers/staging/vt6656/power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
index edc8975..2c8a6b5 100644
--- a/drivers/staging/vt6656/power.c
+++ b/drivers/staging/vt6656/power.c
@@ -269,7 +269,7 @@ int PSbSendNullPacket(struct vnt_private *pDevice)
+ sizeof(struct vnt_tx_mgmt));
 
flags = WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
-WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL);
+   WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL);
 
if (pDevice->bEnablePSMode)
flags |= WLAN_SET_FC_PWRMGT(1);
-- 
1.8.4.1

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


Re: [PATCH 04/11] Staging: bcm: Replace UCHAR with unsigned char in Adapter.h

2013-10-27 Thread Kevin McKinney
On Sun, Oct 27, 2013 at 11:25:55AM +0300, Dan Carpenter wrote:
> On Sat, Oct 26, 2013 at 02:15:13AM -0400, Kevin McKinney wrote:
> > This patch replace "UCHAR" with "unsigned
> > char" in Adapter.h
> 
> I feel like these should pretty much all be u8 instead of "unsigned
> char".

Yeah, I thought about changing these to u8. I will resubmit these 11 patches.

Thanks,
Kevin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: lnet: Rewrite return statement in socklnd.c

2013-10-27 Thread Lisa Nguyen
Rewrite the return statement in socklnd.c to eliminate the
use of a ternary operator. This will prevent the checkpatch.pl
script from generating a warning saying to remove () from
this particular return statement.

Signed-off-by: Lisa Nguyen 
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 6825b45..2ddc3aa 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1768,7 +1768,10 @@ ksocknal_close_matching_conns (lnet_process_id_t id, 
__u32 ipaddr)
if (id.nid == LNET_NID_ANY || id.pid == LNET_PID_ANY || ipaddr == 0)
return (0);
 
-   return (count == 0 ? -ENOENT : 0);
+   if (count == 0)
+   return -ENOENT;
+   else
+   return 0;
 }
 
 void
-- 
1.8.1.2

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


Re: [PATCH] staging:ktap:loader.c fix coding style

2013-10-27 Thread Jovi Zhangwei
On Mon, Oct 28, 2013 at 4:58 AM, Greg KH  wrote:
> On Mon, Oct 28, 2013 at 12:43:04AM +0530, Gokulnath A wrote:
>> fixed the errors and warnings generated by
>> checkpatch.pl script.
>>
>> Signed-off-by: Gokulnath A 
>> ---
>>  drivers/staging/ktap/interpreter/loader.c | 27 +--
>>  1 file changed, 13 insertions(+), 14 deletions(-)
>
> This code just got deleted from the staging tree, so no need to clean it
> up anymore, sorry.
>
Hi Gokulnath,

Thanks your patch, Greg is right, ktap got removed from staging tree now,
the patch is below.

(I'm glad if you are willing to looking at ktap tree in github)


--
Subject: staging: ktap: remove code from tree

ktap should be merged through the "proper" place in the kernel tree, in
the perf tool, not as a stand-alone kernel module in staging.  So remove
it from here for now so that it can be merged correctly later.

Reported-by: Ingo Molnar 
Cc: Jovi Zhangwei 
Cc: Steven Rostedt 
Signed-off-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: Add NULL checks against return values of skb_clone() and dev_alloc_skb()

2013-10-27 Thread RUC_SoftSec
When there is no enough memory, functions skb_clone() and dev_alloc_skb() may 
return NULL pointers, they should be checked against NULL before used.
This bug is found by a static analysis tool developed by RUC_SoftSec, supported 
by China.X.Orion.

Signed-off-by: RUC_SoftSec 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 1617f2e..1409025 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -849,7 +849,7 @@ u8 parse_subframe(struct sk_buff *skb,
 #ifdef JOHN_NOCPY
sub_skb = skb_clone(skb, GFP_ATOMIC);
if (sub_skb == NULL) {
-   printk("%s: skb_clone() failed, no enough 
memory\n", __FUNCTION__);
+   printk("%s: skb_clone() failed\n", 
__FUNCTION__);
return 0;
}
sub_skb->len = nSubframe_Length;
@@ -858,7 +858,7 @@ u8 parse_subframe(struct sk_buff *skb,
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
if (sub_skb == NULL) {
-   printk("%s: dev_alloc_skb() failed, no enough 
memory\n", __FUNCTION__);
+   printk("%s: dev_alloc_skb() failed\n", 
__FUNCTION__);
return 0;
}
skb_reserve(sub_skb, 12);
-- 
1.7.9.5

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


Re: [PATCH 2/2] staging: Add NULL checks against return values of skb_clone() and dev_alloc_skb()

2013-10-27 Thread Greg Kroah-Hartman
On Mon, Oct 28, 2013 at 11:00:32AM +0800, RUC_SoftSec wrote:
> When there is no enough memory, functions skb_clone() and dev_alloc_skb() may 
> return NULL pointers, they should be checked against NULL before used.
> This bug is found by a static analysis tool developed by RUC_SoftSec, 
> supported by China.X.Orion.

Please wrap your lines properly.

But this description does not pertain to the patch at all, your patch
does not seem to do anything different at all.

> Signed-off-by: RUC_SoftSec 

I need a real name here, not an alias/company, that's not acceptable,
sorry.

Oh, and where is patch 1/2, I only see this single patch.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] staging: Add NULL checks to return value of skb_clone() and dev_alloc_skb()

2013-10-27 Thread RUC_SoftSec
Function skb_clone() and dev_alloc_skb() may return NULL pointers if there is 
no enough memroy, their return values should be checked against NULL before 
used.
This bug is found by a static tool developed by RUC_SoftSec, supported by 
China.X.Orion.

Signed-off-by: RUC_SoftSec 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 59900bf..9162151 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -848,11 +848,19 @@ u8 parse_subframe(struct sk_buff *skb,
 
 #ifdef JOHN_NOCPY
sub_skb = skb_clone(skb, GFP_ATOMIC);
+   if (sub_skb == NULL) {
+   printk("ERR in %s(), skb_clone() failed\n", 
__FUNCTION__);
+   return 0;
+   }
sub_skb->len = nSubframe_Length;
sub_skb->tail = sub_skb->data + nSubframe_Length;
 #else
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
+   if (sub_skb == NULL) {
+   printk("ERR in %s(), dev_alloc_skb() failed\n", 
__FUNCTION__);
+   return 0;
+   }
skb_reserve(sub_skb, 12);
data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length);
memcpy(data_ptr,skb->data,nSubframe_Length);
-- 
1.7.9.5

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


[PATCH 1/1] staging: check return value of dev_alloc_skb() against NULL

2013-10-27 Thread RUC_SoftSec
Function dev_alloc_skb() may return a NULL pointer if there is no enough 
memory, it should be checked against NULL before used.
This bug is found by a static analysis tool developed by RUC_SoftSec, supported 
by China.X.Orion.

Signed-off-by: RUC_SoftSec 
---
 drivers/staging/rtl8192u/r819xU_firmware.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c 
b/drivers/staging/rtl8192u/r819xU_firmware.c
index bb924ac..045e48c 100644
--- a/drivers/staging/rtl8192u/r819xU_firmware.c
+++ b/drivers/staging/rtl8192u/r819xU_firmware.c
@@ -66,6 +66,10 @@ bool fw_download_code(struct net_device *dev, u8 
*code_virtual_address, u32 buff
#else
skb  = dev_alloc_skb(frag_length + 4);
#endif
+   if (skb == NULL) {
+   rt_status = false;
+   break;
+   }
memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->queue_index = TXCMD_QUEUE;
@@ -124,6 +128,10 @@ fwSendNullPacket(
 
//Get TCB and local buffer from common pool. (It is shared by CmdQ, 
MgntQ, and USB coalesce DataQ)
skb  = dev_alloc_skb(Length+ 4);
+   if (skb == NULL) {
+   rtStatus = false;
+   return rtStatus;
+   }
memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->queue_index = TXCMD_QUEUE;
-- 
1.7.9.5

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


[PATCH 1/1] staging: Add a NULL check to return value of dev_alloc_skb()

2013-10-27 Thread RUC_SoftSec
Function dev_alloc_skb() may return a NULL pointer when there is no enough 
memory, its return value should be checked before used.
This bug is found by a static analysis tool developed by RUC_SoftSec, supported 
by China.X.Orion.

Signed-off-by: RUC_SoftSec 
---
 .../staging/rtl8192e/rtl8192e/r8192E_firmware.c|4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c 
b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index dd2a96b..baf15d7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -61,6 +61,10 @@ static bool fw_download_code(struct net_device *dev, u8 
*code_virtual_address,
}
 
skb  = dev_alloc_skb(frag_length + 4);
+   if (skb == NULL) {
+   rt_status = true;
+   break;
+   }
memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->queue_index = TXCMD_QUEUE;
-- 
1.7.9.5

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


Re: [PATCH v4 1/2] Staging: zram: Fix variable dereferenced before check

2013-10-27 Thread Minchan Kim
Hello Rashika,


On Fri, Oct 25, 2013 at 7:10 PM, Minchan Kim  wrote:
> Hello Rashika,
>
> First of all, thanks for looking this!
>
> On Tue, Oct 22, 2013 at 07:00:57PM +0530, Rashika Kheria wrote:
>> This patch fixes the following Smatch warning in zram_drv.c-
>> drivers/staging/zram/zram_drv.c:663
>> reset_store() warn: variable dereferenced before check 'bdev' (see line 652)
>> drivers/staging/zram/zram_drv.c:899
>> destroy_device() warn: variable dereferenced before check 'zram->disk' (see 
>> line 896)
>>
>> Signed-off-by: Rashika Kheria 
>> ---
>>
>> This revision fixes the following issues of the previous revision:
>> Remove unnecessary checks
>>
>>  drivers/staging/zram/zram_drv.c |   16 +++-
>>  1 file changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/staging/zram/zram_drv.c 
>> b/drivers/staging/zram/zram_drv.c
>> index 2c4ed52..8679a06 100644
>> --- a/drivers/staging/zram/zram_drv.c
>> +++ b/drivers/staging/zram/zram_drv.c
>> @@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev,
>>   zram = dev_to_zram(dev);
>>   bdev = bdget_disk(zram->disk, 0);
>>
>> + if (!bdev)
>> + return -EBUSY;
>> +
>
> I'd like to look into that when bdget_disk could fail but I don't have a time
> so sorry. I will review it when I return back to the office in next week.


I reviewed that part and realized bdget_disk could fail when memory is
tight so you're right.

But please separate it with two stuffs.

1. fix reset_store bug caused by accessing NULL ptr
2. fix destroy_device by smatch warning.

1 is real bug fix which NULL ptr access will happen when memory is
tight although it's very rare so that IMO, it should go stable tree
while 2 is just smatch warning which will never happen in real
practice.

Thanks for looking this!

-- 
Kind regards,
Minchan Kim
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: sb105x: Remove unneeded semicolon in sb_pci_mp.c

2013-10-27 Thread Lisa Nguyen
Remove unneeded semicolon in sb_pci_mp.c to meet kernel
coding style.

Signed-off-by: Lisa Nguyen 
---
 drivers/staging/sb105x/sb_pci_mp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sb105x/sb_pci_mp.c 
b/drivers/staging/sb105x/sb_pci_mp.c
index bc53b4e..11c047e 100644
--- a/drivers/staging/sb105x/sb_pci_mp.c
+++ b/drivers/staging/sb105x/sb_pci_mp.c
@@ -1216,7 +1216,7 @@ static int mp_ioctl(struct tty_struct *tty, unsigned int 
cmd, unsigned long arg)
return 
(inb(mp_devs[arg].option_reg_addr+MP_OPTR_IIR0+(state->port->line/8)));
}
case TIOCGGETPORTTYPE:
-   ret = get_device_type(arg);;
+   ret = get_device_type(arg);
return ret;
case TIOCSMULTIECHO: /* set to multi-drop mode(RS422) or echo 
mode(RS485)*/
outb( ( inb(info->interface_config_addr) & ~0x03 ) | 
0x01 ,  
-- 
1.8.1.2

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