Skip to contentSkip to conversation

Check if skb_alloc returns Null in function fw_download_code

PATCH Superseded Nicholas Krause 2 participants 3 messages Jun 17, 2014 1 message not in the archive Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Check if skb_alloc returns Null in function fw_download_code

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2 -0
index 1a95d1f..11e915e 100644
@@ -61,11 +61,13 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
 		}
 
 		skb  = dev_alloc_skb(frag_length + 4);
+		if (skb)
+			return 0;
 			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;
 			tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT;
 			tcb_desc->bLastIniPkt = bLastIniPkt;
 
 		seg_ptr = skb->data;
 		for (i = 0; i < frag_length; i += 4) {
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 13 lines · Nicholas Krause
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0 -0
index 1a95d1f..11e915e 100644
@@ -61,11 +61,13 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
 		}
 
 		skb  = dev_alloc_skb(frag_length + 4);

drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 73

Quoted 10 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2 -0
+		if (skb)
+			return 0;
 			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;
 			tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT;
 			tcb_desc->bLastIniPkt = bLastIniPkt;
 
 		seg_ptr = skb->data;
 		for (i = 0; i < frag_length; i += 4) {

This patch doesn't even apply, what are you doing to create it?

And does it look correct? To me it sure does not...

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CAPDOMVii1ZHTSsW5J4tjCgvqY1N-cJmULSFt1sB5fw2aabHnBA@mail.gmail.com

maintainer
#3 lore raw
Quoted 2 lines · Nick Krause

I created it using  git-format patch and check my condition is wrong should be !skb to check for Nulls .

That's not the real problem here.

The real issue is you can not apply your patch to any tree. Please remove all patches from your tree that you might have made and rebase your change on top of a "clean" 3.16-rc1 kernel tree.

thanks,

greg k-h