Re: [PATCH] staging: Check for Null return of allocated skb in fw_download_code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 12, 2014 at 11:24 PM, Nicholas Krause <xerofoify@xxxxxxxxx> wrote:
> This patch checks if we are getting a Null allocated skb in the while/do
> loop of this function. Further more no reference checking is needing
> as skb_put is only working with the packet defined by skb and not allocating
> a new one. Further more I am breaking out of the loop in order to make sure
> we call nic_write_byte and cause no errors with writing the nic byte(s) of
> private date and then call rt_status which I changed to false in the loop
> with my additon of checking the allocated skb.
>
> Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx>
> ---
>  drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> index 1a95d1f..829af66 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
> @@ -61,6 +61,10 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
>                 }
>
>                 skb  = dev_alloc_skb(frag_length + 4);
> +               if (skb == NULL) {
> +                       rt_status =  false;
> +                       break;
> +               }
>                 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;
> --
> 1.9.1
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Sorry about the two patches please read only the second one, I send twice.
Nick

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux