Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1640870 > unrolled thread

[PATCH 1/2] fdt: correctly handle uncompressed node names

Started bySascha Silbe <x-linux@infra-silbe.de>
First post2017-05-13 12:40 +0200
Last post2017-05-15 17:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] fdt: correctly handle uncompressed node names Sascha Silbe <x-linux@infra-silbe.de> - 2017-05-13 12:40 +0200
    Re: [PATCH 1/2] fdt: correctly handle uncompressed node names kbuild test robot <lkp@intel.com> - 2017-05-13 14:40 +0200
    Re: [PATCH 1/2] fdt: correctly handle uncompressed node names Rob Herring <robh+dt@kernel.org> - 2017-05-15 17:30 +0200

#1640870 — [PATCH 1/2] fdt: correctly handle uncompressed node names

FromSascha Silbe <x-linux@infra-silbe.de>
Date2017-05-13 12:40 +0200
Subject[PATCH 1/2] fdt: correctly handle uncompressed node names
Message-ID<tGCCR-2pX-5@gated-at.bofh.it>
When handling uncompressed node names, we need to compare the last
component rather than the entire string.

Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
---
 scripts/dtc/libfdt/fdt_ro.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c
index 3d00d2eee0e3..ca03ff87429c 100644
--- a/scripts/dtc/libfdt/fdt_ro.c
+++ b/scripts/dtc/libfdt/fdt_ro.c
@@ -64,6 +64,9 @@ static int _fdt_nodename_eq(const void *fdt, int offset,
 		/* short match */
 		return 0;
 
+	if (*p == '/')
+		/* Uncompressed node name. Only compare the last part. */
+		p = strrchr(p, '/') + 1;
 	if (memcmp(p, s, len) != 0)
 		return 0;
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1640907

Fromkbuild test robot <lkp@intel.com>
Date2017-05-13 14:40 +0200
Message-ID<tGEuZ-3Cf-1@gated-at.bofh.it>
In reply to#1640870

[Multipart message — attachments visible in raw view] — view raw

Hi Sascha,

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.11 next-20170512]
[cannot apply to glikely/devicetree/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sascha-Silbe/fdt-correctly-handle-uncompressed-node-names/20170513-184012
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm64-alldefconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   ./drivers/firmware/efi/libstub/lib.a(lib-fdt_ro.stub.o): In function `__efistub_fdt_subnode_offset_namelen':
>> __efistub_fdt_ro.c:(.init.text+0x248): undefined reference to `__efistub_strrchr'
   __efistub_fdt_ro.c:(.init.text+0x248): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__efistub_strrchr'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1641810

FromRob Herring <robh+dt@kernel.org>
Date2017-05-15 17:30 +0200
Message-ID<tHq6C-1u3-15@gated-at.bofh.it>
In reply to#1640870
On Sat, May 13, 2017 at 5:22 AM, Sascha Silbe <x-linux@infra-silbe.de> wrote:
> When handling uncompressed node names, we need to compare the last
> component rather than the entire string.
>
> Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
> ---
>  scripts/dtc/libfdt/fdt_ro.c | 3 +++
>  1 file changed, 3 insertions(+)

This needs to be a patch against dtc, sent to devicetree-compiler list
and accepted there, then I can pick it up.

>
> diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c
> index 3d00d2eee0e3..ca03ff87429c 100644
> --- a/scripts/dtc/libfdt/fdt_ro.c
> +++ b/scripts/dtc/libfdt/fdt_ro.c
> @@ -64,6 +64,9 @@ static int _fdt_nodename_eq(const void *fdt, int offset,
>                 /* short match */
>                 return 0;
>
> +       if (*p == '/')
> +               /* Uncompressed node name. Only compare the last part. */
> +               p = strrchr(p, '/') + 1;

However, you are changing behavior here that I'd guess has existed for
some time. This makes me suspicious that this is correct especially
when it is non-FDT DT you are trying to fix.

Given that 0-day reports an error with EFI stub, you also have to
consider if u-boot, barebox, grub, and all the other libfdt users
provide strrchr.

Rob

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web