From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Peter Tyser <ptyser-AQeFf1F/bRxBDgjK7y7TUQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH] fdt_ro: Fix fdt_get_property_namelen() length bug
Date: Tue, 29 Mar 2011 12:34:46 +1100 [thread overview]
Message-ID: <20110329013446.GM8428@yookeroo> (raw)
In-Reply-To: <1301350775-27040-1-git-send-email-ptyser-AQeFf1F/bRxBDgjK7y7TUQ@public.gmane.org>
On Mon, Mar 28, 2011 at 05:19:35PM -0500, Peter Tyser wrote:
> fdt_get_property_namelen() should only compare 'namelen' characters when
> matching a property name. The previous code compared 'namelen'
> characters correctly, but also required the property name length to
> exactly match 'namelen'.
>
> This length matching requirement would result in bugs such as
> "ethernet0" not being found when using fdt_get_property_namelen() to
> find properties starting with "ethernet".
Nack. The current behaviour of the *_namelen() functions is the
intended one. Their purpose is not for doing partial matches, but
instead for doing exact matches, but using a non-null-terminated
string as the argument. For example get_subnode_offset_namelen() is
used internally for comparing names against path components without
having to copy and null terminate the pieces of the path first.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2011-03-29 1:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 22:19 [PATCH] fdt_ro: Fix fdt_get_property_namelen() length bug Peter Tyser
[not found] ` <1301350775-27040-1-git-send-email-ptyser-AQeFf1F/bRxBDgjK7y7TUQ@public.gmane.org>
2011-03-29 1:34 ` David Gibson [this message]
2011-03-29 2:47 ` Peter Tyser
2011-03-29 4:04 ` David Gibson
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=20110329013446.GM8428@yookeroo \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=ptyser-AQeFf1F/bRxBDgjK7y7TUQ@public.gmane.org \
/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).