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

Dan Carpenter dan.carpenter at oracle.com
Fri Apr 25 13:11:05 UTC 2014


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.

regards,
dan carpenter



More information about the devel mailing list