Re: [PATCH] counter: fix an IS_ERR() vs NULL bug

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

 



On Tue, Jan 11, 2022 at 09:20:55AM +0100, Uwe Kleine-König wrote:
> On Tue, Jan 11, 2022 at 10:25:00AM +0300, Dan Carpenter wrote:
> > There are 8 callers for devm_counter_alloc() and they all check for NULL
> > instead of error pointers.  I think NULL is the better thing to return
> > for allocation functions so update counter_alloc() and devm_counter_alloc()
> > to return NULL instead of error pointers.
> > 
> > Fixes: c18e2760308e ("counter: Provide alternative counter registration functions")
> > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> Oh indeed. I wonder how you found that problem.

Of course from static analysis.  Each caller triggers a "this NULL
check should be an IS_ERR() check warning" followed by a "potential
error pointer dereference" warning.

regards,
dan carpenter




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux