The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "andriy.shevchenko@linux.intel.com"  <andriy.shevchenko@linux.intel.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: YE Chengfeng <cyeaa@connect.ust.hk>,
	"heikki.krogerus@linux.intel.com"
	<heikki.krogerus@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: suspected null-pointer-reference problem for to_swnode
Date: Tue, 26 Oct 2021 19:33:09 +0300	[thread overview]
Message-ID: <YXgtxXNIyJ8+G4Oy@smile.fi.intel.com> (raw)
In-Reply-To: <YXgavSb+/NoGclFS@paasikivi.fi.intel.com>

On Tue, Oct 26, 2021 at 06:11:57PM +0300, Sakari Ailus wrote:
> On Mon, Oct 25, 2021 at 07:40:55PM +0300, andriy.shevchenko@linux.intel.com wrote:
> > On Mon, Oct 25, 2021 at 02:03:51PM +0000, YE Chengfeng wrote:
> > > Hi, 
> > > 
> > > https://github.com/torvalds/linux/blob/master/drivers/base/swnode.c#L405
> > > 
> > > We notice that the return pointer of to_swnode is null check in some case, while in some case is not. For example, at line 416, the return pointer is null-check, but in line 405 is not. We want to know whether it would be a potential null pointer dereference problem, in the case that null-check is missing.
> > > 
> > > This problem is detected by our experimental static analysis tool, we are not familiar with the source code and it could just be a false positive. We send this email in case this is a real problem. Would you like to spare some time to have a look at it?
> > 
> > Thank you for the interest to our code!
> > 
> > Line #405 refers to software node operations and it means it won't be ever
> > called if there is no swnode behind it, means it's backed with properties.
> > If you think it will be a NULL pointer there, please describe in detail
> > (with a traceback included) when and how it happens, because such bugs are
> > serious.
> > 
> > Line #416 refers to the same stage when options are defined and we know we
> > have been called against swnode. Seems to me like a dead code brought from
> > day 1 by the commit bc0500c1e43d ("device property: Add fwnode_get_name
> > for returning the name of a node").
> > 
> > Sakari?
> 
> Yeah, the check could be removed.

I have just sent a patch.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2021-10-26 17:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 14:03 suspected null-pointer-reference problem for to_swnode YE Chengfeng
2021-10-25 16:40 ` andriy.shevchenko
2021-10-26 10:12   ` 回复: " YE Chengfeng
2021-10-26 15:11   ` Sakari Ailus
2021-10-26 16:33     ` andriy.shevchenko [this message]

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=YXgtxXNIyJ8+G4Oy@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=cyeaa@connect.ust.hk \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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