Re: [PATCH] staging: wlan-ng: check return value of kmalloc

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

 



On Wed, May 13, 2015 at 01:36:44PM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> On Wed, May 13, 2015 at 03:02:25PM +0300, Dan Carpenter wrote:
> > On Wed, May 13, 2015 at 02:51:07PM +0300, Dan Carpenter wrote:
> > > On Wed, May 13, 2015 at 11:32:50AM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> > > > check return value of kmalloc before accessing the memory pointer.This
> > > > function returns a non-zero value on failure hence a return value of 1
> > > > is used.
> > > 
> > > Could you do some reasearch where this thing is freed?
> > 
> > 
> > Never mind.  It's freed in the caller.  But it does a weird thing:
> > 
> > TODO-list:  Clean up p80211_wep->data allocation in p80211knetdev_hard_start_xmit().
> > 
> > It's set to NULL, then memset to zero, then when we call
> > skb_ether_to_p80211() we again set it to NULL then at the end we check
> > if it is equal to skb->data (it is not), and we also call kzfree()
> > instead of kfree().  Load of nonsense.
> > 
> > regards,
> > dan carpenter
> > 
> 
> yes Dan I did see the code.Should it be corrected ? Is this driver going
> to be removed as its supporting a legacy device? I couldn't see any
> patches being submitted against this driver for few months.

Can you just return -ENOMEM instead of 1.

It's not important to match the surrounding style since the surrounding
style is garbage.

regards,
dan carpenter

_______________________________________________
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