From: Paul Mackerras <paulus@samba.org>
To: michael@ellerman.id.au
Cc: linuxppc-dev@ozlabs.org, Timur Tabi <timur@freescale.com>
Subject: Re: [PATCH] Add null pointer check to of_find_property
Date: Fri, 9 May 2008 14:50:19 +1000 [thread overview]
Message-ID: <18467.55307.873805.423244@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <1210202466.16180.1.camel@localhost>
Michael Ellerman writes:
> On Wed, 2008-05-07 at 14:19 -0500, Timur Tabi wrote:
> > Update function of_find_property() to return NULL if the device_node passed
> > to it is also NULL. Otherwise, passing NULL will cause a null pointer
> > dereference.
> >
> > Signed-off-by: Timur Tabi <timur@freescale.com>
> > ---
> >
> > This patch allows callers to do this:
>
> np = of_find_compatible_node(...);
> prop = of_get_property(np);
> if (!prop)
> goto error;
>
> ...
>
> error:
> of_node_put(np)
>
> :)
And of_node_put looks like this:
void of_node_put(struct device_node *node)
{
if (node)
kref_put(&node->kref, of_node_release);
}
so it's OK.
:)
Paul.
next prev parent reply other threads:[~2008-05-09 4:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-07 19:19 [PATCH] Add null pointer check to of_find_property Timur Tabi
2008-05-07 19:27 ` Grant Likely
2008-05-07 23:21 ` Michael Ellerman
2008-05-09 4:50 ` Paul Mackerras [this message]
2008-05-12 16:46 ` Timur Tabi
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=18467.55307.873805.423244@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=michael@ellerman.id.au \
--cc=timur@freescale.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;
as well as URLs for NNTP newsgroup(s).