staging: rtl8192 Check for Null return from dev_skb_alloc
PATCH 1/1 staging: rtl8192 Check for Null return from dev_skb_alloc
Checks for Null return from dev_skb_alloc if it returns Null, fw_download returns false. Otherwise it returns true.Also removed rt_status due to returning true of false directly.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +4 -3
@@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) {struct r8192_priv *priv =rtllib_priv (dev); -bool rt_status = true;u16 frag_threshold;u16 frag_length, frag_offset =0 ;int i;
@@ -59,7 +58,9 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, bLastIniPkt =1 ; } - + skb =dev_alloc_skb (frag_length +4 ); +if (!skb) +return false; skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); tcb_desc = (struct cb_desc *)(skb->cb +MAX_DEV_ADDR_SIZE );
@@ -99,7 +100,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,write_nic_byte (dev, TPPoll, TPPoll_CQ); -return rt_status; +return false; }static bool CPUcheck_maincodeok_turnonCPU (struct net_device *dev)
Signature · 1 line
1.9.1
Hey Guys,
So Sorry about wasting your time with bad patchs.
I feel bad about that. I hope this patch is O.K.
now. :(
Nicholas Krause
Quoted 44 lines · Nicholas Krause
Checks for Null return from
dev_skb_allocif it returns Null,fw_downloadreturns false. Otherwise it returns true.Also removedrt_statusdue to returning true of false directly.Signed-off-by Nicholas Krause <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +4
-4@@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) {struct r8192_priv *priv =rtllib_priv (dev); -bool rt_status = true;u16 frag_threshold;u16 frag_length, frag_offset =0 ;int i;@@ -59,7 +58,9 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, bLastIniPkt =1 ; } - + skb =dev_alloc_skb (frag_length +4 ); +if (!skb) +return false; skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); tcb_desc = (struct cb_desc *)(skb->cb +MAX_DEV_ADDR_SIZE );@@ -99,7 +100,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,write_nic_byte (dev, TPPoll, TPPoll_CQ); -return rt_status; +return false; }static bool CPUcheck_maincodeok_turnonCPU (struct net_device *dev) --1.9.1
Quoted 4 lines · Nick Krause
Hey Guys,
So Sorry about wasting your time with bad patchs.
I feel bad about that. I hope this patch is O.K.
now. :(
It's not.
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0
[]
Quoted 9 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 64
Quoted 9 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +3
-1@@ -59,7 +58,9 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, bLastIniPkt =1 ; } - + skb =dev_alloc_skb (frag_length +4 ); +if (!skb) +return false; skb =dev_alloc_skb (frag_length +4 );
You're still wasting time and not thoroughly
reading your own patches.
You've duplicated the dev_alloc_skb line.
Quoted 4 lines · Nick Krause
Hey Guys,
So Sorry about wasting your time with bad patchs.
I feel bad about that. I hope this patch is O.K.
now. :(
Oh, one other thing...
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0
[]
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 41
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-1@@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) {struct r8192_priv *priv =rtllib_priv (dev); -bool rt_status = true;u16 frag_threshold;u16 frag_length, frag_offset =0 ;int i;
[]
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 103
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +1
-1@@ -99,7 +100,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,write_nic_byte (dev, TPPoll, TPPoll_CQ); -return rt_status; +return false;
This should be:
return true;
Thanks Joe,
I need to read my patches more carefully.
Nick :)
Quoted 32 lines · Joe Perches
Quoted 4 lines · Nick Krause
Hey Guys,
So Sorry about wasting your time with bad patchs.
I feel bad about that. I hope this patch is O.K.
now. :(Oh, one other thing...
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0[]
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 41
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-1@@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) {struct r8192_priv *priv =rtllib_priv (dev); -bool rt_status = true;u16 frag_threshold;u16 frag_length, frag_offset =0 ;int i;[]
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 103
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +1
-1@@ -99,7 +100,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,write_nic_byte (dev, TPPoll, TPPoll_CQ); -return rt_status; +return false;This should be:
return true;