staging: rtl8192e: check return value of dev_skb_alloc
PATCH 1/1 staging: rtl8192e: check return value of dev_skb_alloc
Checks if dev_skb_alloc returns Null in function, fw_download_code. If the return value of dev_skb_alloc is NULL return false and exit this function.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2 -0
@@ -62,6 +62,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); +if (!skb) +return !rt_status; tcb_desc = (struct cb_desc *)(skb->cb +MAX_DEV_ADDR_SIZE ); tcb_desc->queue_index =TXCMD_QUEUE ; tcb_desc->bCmdOrInit =DESC_PACKET_TYPE_INIT ;
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 13 lines · Nicholas Krause
Checks if
dev_skb_allocreturns Null in function,fw_download_code. If the return value ofdev_skb_allocis NULL return false and exit this function.Signed-off-by Nicholas Krause <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 69
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2
-0@@ -62,6 +62,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); +if (!skb) +return !rt_status; tcb_desc = (struct cb_desc *)(skb->cb +MAX_DEV_ADDR_SIZE ); tcb_desc->queue_index =TXCMD_QUEUE ; tcb_desc->bCmdOrInit =DESC_PACKET_TYPE_INIT ;
As writing emails to you seems like dumping stuff into a vacuum, I'm going to just delete this message and start ignoring your mail like you seem to be ignoring mine...
Best of luck,
greg k-h
Quoted 3 lines · Nicholas Krause
Checks if
dev_skb_allocreturns Null in function,fw_download_code. If the return value ofdev_skb_allocis NULL return false and exit this function.
Hello Nicholas.
If you're going to try add these checks, please look at the code a bit more before submitting defective patches.
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0
[]
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 66
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2
-0@@ -62,6 +62,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); +if (!skb) +return !rt_status;
Umm, if you're going to check whether or not skb is NULL, do it before it's dereferenced as skb->cb.
Oh, and get rid of rt_status and use
return false;
directly.
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 69
Quoted 3 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0tcb_desc = (struct cb_desc *)(skb->cb +MAX_DEV_ADDR_SIZE ); tcb_desc->queue_index =TXCMD_QUEUE ; tcb_desc->bCmdOrInit =DESC_PACKET_TYPE_INIT ;
and change the end of function
from:
return rt_status; to: return true;
Quoted 13 lines · Nicholas Krause
Checks if
dev_skb_allocreturns Null in function,fw_download_code. If the return value ofdev_skb_allocis NULL return false and exit this function.Signed-off-by Nicholas Krause <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 66
Quoted 5 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2
-0@@ -62,6 +62,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); +if (!skb) +return !rt_status;
What's this !rt_status? Just return false.
regards,
dan carpenter
Hey guys,
Sorry about no reply,
my power supply died last night, have to get a new one. I will be RMAing the old old in order to get a packup in case this PSU dies.
Cheers Nick
Quoted 25 lines · Dan Carpenter
Quoted 13 lines · Nicholas Krause
Checks if
dev_skb_allocreturns Null in function,fw_download_code. If the return value ofdev_skb_allocis NULL return false and exit this function.Signed-off-by Nicholas Krause <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0
-0drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, · line 66
Quoted 5 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +2
-0@@ -62,6 +62,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb =dev_alloc_skb (frag_length +4 );memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev)); +if (!skb) +return !rt_status;What's this !rt_status? Just return false.
regards,
dan carpenter