Re: [PATCH] staging: vt6656: Fix dereference before NULL check

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

 



On 2014-04-25 at 15:11:05 +0200, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> On Fri, Apr 25, 2014 at 01:54:51PM +0200, Tobias Klauser wrote:
> > pFifoHead is dereferenced before it is checked for NULL which implies it
> > can potentially be NULL. Thus move the check before the dereference.
> > 
> > Found by the coverity scanner, CID 1127221.
> > 
> 
> pFifoHead is this:
> 
> struct vnt_tx_fifo_head *pFifoHead = &tx_buffer->fifo_head;
> 
> Even if tx_buffer were NULL, the address of tx_buffer->fifo_head would
> be non-NULL.  The NULL test serves no purpose.  If tx_buffer were NULL
> we would still get an oops though.  According to smatch, tx_buffer is
> never NULL but I haven't verified manually.

Hm, silly me... Thanks for pointing out Dan.

I manually checked now and it seems that tx_buffer can never be NULL. So
it should be fine to remove the test altogether.

I'll send an updated patch.

Thanks
_______________________________________________
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