On Tue, Apr 07, 2015 at 07:44:38AM -0400, Peter Hurley wrote: > On 04/07/2015 07:12 AM, Peter Hurley wrote: > > On 04/07/2015 12:49 AM, David Gibson wrote: > >> I did spot a case where the existing code is arguably incorrect: using > >> fdt_path_offset_namelen(fdt, "/somenode\0foo", 13) will return the > >> same as fdt_path_offset(fdt, "/somenode"), although I think ideally it > >> should always return -FDT_ERR_NOTFOUND, or some other error, since > >> node names can never include \0. > > > > Ok, I'll fix that. > > I think your memchr() is broken. > > Patch below passes with the following output: > .... > Checking offset of "/subnode@2/subsubnode@0/more" [first 24 characters] is 380... > Checking offset of "/subnode@2/subsubnode@0/more" [first 25 characters] is -1... > Checking offset of "/subnode@1" [first 14 characters] is -1... > PASS Huh, weird. I had a similar test to this, but not identical and the other day it failed. Today, your test passes for me, and I can't remember what my test was or otherwise trigger a problem. Oh well, I guess we just leave it for now, and debug if it ever appears again. > > Regards, > Peter Hurley > > --- >% --- > diff --git a/tests/path_offset.c b/tests/path_offset.c > index bfebe9f..2788957 100644 > --- a/tests/path_offset.c > +++ b/tests/path_offset.c > @@ -133,5 +133,7 @@ int main(int argc, char *argv[]) > check_path_offset_namelen(fdt, "/subnode@2/subsubnode@0/more", 24, subsubnode2_offset2); > check_path_offset_namelen(fdt, "/subnode@2/subsubnode@0/more", 25, -FDT_ERR_NOTFOUND); > > + check_path_offset_namelen(fdt, "/subnode@1\0foo", 14, -FDT_ERR_NOTFOUND); > + > PASS(); > } > > -- 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
Attachment:
pgpjAAHqFFejE.pgp
Description: PGP signature