All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] Check if skb_alloc returns Null in function fw_download_code
@ 2014-06-17 16:07 Nicholas Krause
  2014-06-17 20:18 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Krause @ 2014-06-17 16:07 UTC (permalink / raw)
  To: gregkh; +Cc: lisa, valentina.manea.m, ben, devel, linux-kernel

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index 1a95d1f..11e915e 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -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) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv2] Check if skb_alloc returns Null in function fw_download_code
  2014-06-17 16:07 [PATCHv2] Check if skb_alloc returns Null in function fw_download_code Nicholas Krause
@ 2014-06-17 20:18 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2014-06-17 20:18 UTC (permalink / raw)
  To: Nicholas Krause; +Cc: devel, ben, lisa, valentina.manea.m, linux-kernel

On Tue, Jun 17, 2014 at 12:07:12PM -0400, Nicholas Krause wrote:
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> index 1a95d1f..11e915e 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> @@ -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);

Again, look at this code and tell me if it now looks correct after your
change...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2] Check if skb_alloc returns Null in function fw_download_code
       [not found]   ` <CAPDOMVii1ZHTSsW5J4tjCgvqY1N-cJmULSFt1sB5fw2aabHnBA@mail.gmail.com>
@ 2014-06-17 20:18     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2014-06-17 20:18 UTC (permalink / raw)
  To: Nick Krause; +Cc: devel, ben, lisa, Valentina Manea, linux-kernel

On Tue, Jun 17, 2014 at 12:04:59PM -0400, Nick Krause wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2] Check if skb_alloc returns Null in function fw_download_code
  2014-06-17 15:05 Nicholas Krause
@ 2014-06-17 15:46 ` Greg KH
       [not found]   ` <CAPDOMVii1ZHTSsW5J4tjCgvqY1N-cJmULSFt1sB5fw2aabHnBA@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-06-17 15:46 UTC (permalink / raw)
  To: Nicholas Krause; +Cc: devel, ben, lisa, valentina.manea.m, linux-kernel

On Tue, Jun 17, 2014 at 11:05:16AM -0400, Nicholas Krause wrote:
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> index 1a95d1f..11e915e 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> @@ -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) {

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2] Check if skb_alloc returns Null in function fw_download_code
@ 2014-06-17 15:05 Nicholas Krause
  2014-06-17 15:46 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Krause @ 2014-06-17 15:05 UTC (permalink / raw)
  To: gregkh; +Cc: valentina.manea.m, lisa, ben, devel, linux-kernel

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index 1a95d1f..11e915e 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -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) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-17 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17 16:07 [PATCHv2] Check if skb_alloc returns Null in function fw_download_code Nicholas Krause
2014-06-17 20:18 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2014-06-17 15:05 Nicholas Krause
2014-06-17 15:46 ` Greg KH
     [not found]   ` <CAPDOMVii1ZHTSsW5J4tjCgvqY1N-cJmULSFt1sB5fw2aabHnBA@mail.gmail.com>
2014-06-17 20:18     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.