Re: [PATCH] staging: rtl8712: Free memory and return failure when kmalloc fails

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

 



Hi Greg,


On Tue, Oct 25, 2016 at 2:33 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, Oct 20, 2016 at 12:29:33PM +0530, Souptick Joarder wrote:
>> This patch is added to free memory and return failure when kmalloc fails
>
> I'm sorry, but I can not parse that sentance.  Can you rephrase this a
> bit better?  What exactly are you doing here?

  There are few functions where we need to free previously allocated memory
  when kmalloc fails. Else it may lead to memory leakage.
  In  _init_cmd_priv() and _r8712_init_xmit_priv() , few places we are
not freeing
  previously allocated memory  when kmalloc fails.This patch will address it.

  shall I resend the patch?

>
>>
>> Signed-off-by: Souptick joarder <jrdr.linux@xxxxxxxxx>
>> ---
>>  drivers/staging/rtl8712/os_intfs.c     | 3 ++-
>>  drivers/staging/rtl8712/rtl871x_cmd.c  | 5 ++++-
>>  drivers/staging/rtl8712/rtl871x_xmit.c | 5 ++++-
>>  3 files changed, 10 insertions(+), 3 deletions(-)
>
> Any reason why you didn't cc: the driverdevel mailing list?  I doubt
> linux-wireless cares about staging drivers :(

    My Apology. I will add driverdevel mailing list in cc.

>
>>
>> diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
>> index cbe4de0..aab3141 100644
>> --- a/drivers/staging/rtl8712/os_intfs.c
>> +++ b/drivers/staging/rtl8712/os_intfs.c
>> @@ -313,7 +313,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter)
>>               return _FAIL;
>>       if (r8712_init_mlme_priv(padapter) == _FAIL)
>>               return _FAIL;
>> -     _r8712_init_xmit_priv(&padapter->xmitpriv, padapter);
>> +     if ((_r8712_init_xmit_priv(&padapter->xmitpriv, padapter)) != _SUCCESS)
>> +             return _FAIL;
>
> You don't have to unwind anything that r8712_init_mlme_priv() did?

  I didn't get your question?

  r8712_init_drv_sw() is getting called during initialization.
  if _r8712_init_xmit_priv() fails is it required to continue driver
initialization
  or return _FAIL similar like  previous function r8712_init_mlme_priv() ?


>
>>       _r8712_init_recv_priv(&padapter->recvpriv, padapter);
>>       memset((unsigned char *)&padapter->securitypriv, 0,
>>              sizeof(struct security_priv));
>
> thanks,
>
> greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux