Linux IIO development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] counter: fix an IS_ERR() vs NULL bug
Date: Tue, 11 Jan 2022 11:30:05 +0300	[thread overview]
Message-ID: <20220111083005.GF1978@kadam> (raw)
In-Reply-To: <20220111082055.4w3arxe326cn65ht@pengutronix.de>

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@oracle.com>
> 
> 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


  reply	other threads:[~2022-01-11  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  7:25 [PATCH] counter: fix an IS_ERR() vs NULL bug Dan Carpenter
2022-01-11  8:20 ` Uwe Kleine-König
2022-01-11  8:30   ` Dan Carpenter [this message]
2022-01-11  9:27 ` William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220111083005.GF1978@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vilhelm.gray@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox