Skip to contentSkip to conversation

staging: wilc1000: fix mgmt_tx()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wilc1000: fix mgmt_tx()

There was a missing curly brace so this function returns failure instead of succeeding.

Fixes 06fb9336acdc ('staging: wilc1000: wilc_wfi_cfgoperations.c: replaces PRINT_ER with netdev_err')
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +3 -2
index bf264d3..97d1b80 100644
@@ -1832,9 +1832,10 @@ static int mgmt_tx(struct wiphy *wiphy,
 			return -EFAULT;
 
 		mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
-		if (!mgmt_tx->buff)
+		if (!mgmt_tx->buff) {
 			kfree(mgmt_tx);
-			return -EFAULT;
+			return -ENOMEM;
+		}
 
 		memcpy(mgmt_tx->buff, buf, len);
 		mgmt_tx->size = len;
#1 lore raw

Am 10.02.2016 10:05, schrieb Dan Carpenter:

Quoted 13 lines

There was a missing curly brace so this function returns failure instead of succeeding.

Fixes 06fb9336acdc ('staging: wilc1000: wilc_wfi_cfgoperations.c: replaces PRINT_ER with netdev_err')
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0 -0
index bf264d3..97d1b80 100644
@@ -1832,9 +1832,10 @@ static int mgmt_tx(struct wiphy *wiphy,
 			return -EFAULT;
 

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int mgmt_tx(struct wiphy *wiphy, · line 1841

Quoted 10 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +3 -2
 		mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
-		if (!mgmt_tx->buff)
+		if (!mgmt_tx->buff) {
 			kfree(mgmt_tx);
-			return -EFAULT;
+			return -ENOMEM;
+		}
 
 		memcpy(mgmt_tx->buff, buf, len);
 		mgmt_tx->size = len;

perhaps this is a case for kmemdup() ?

mgmt_tx->buff = kmemdup(buf, buf_len or len ?, GFP_KERNEL);

sorry, i can not see what len from this patch.

re,
wh