Re: [PATCH v2 0/2] Remove trailing zero from the overlay path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Nov 11, 2019 at 10:04:42AM +0200, Stefan Mavrodiev wrote:
> When libfdt applies overlay, which has aliases, they are added to
> the __symbols__ node. Since the overlay path is string, it ends with
> trailing zero. However, when calculating path length, this symbol should
> be excluded. The effect is, that the property is treated as integer
> instead of string.

Applied, thanks.

> 
> Here is a simple example. Using test/overlay_base:
> / {
>     test-node {
> 	...
>     };
>     __symbols__ {
>         test = "/test-node";
>         ...
>     };
> };
> 
> Compaling simple overlay with alias node:
> / {
>     fragment@0 {
>         target = <0xffffffff>;
>         __overlay__ {
>             foo {
>                 bar = "bar";
>                 phandle = <0x00000001>;
>             };
>         };
>     };
>     __symbols__ {
>         foo = "/fragment@0/__overlay__/foo";
>     };
>     __fixups__ {
>         test = "/fragment@0:target:0";
>     };
> };
> 
> After merge:
> / {
>    ...
>     __symbols__ {
>         foo = <0x2f746573 0x742d6e6f 0x64652f66 0x6f6f0000>;
>         ...
>     };
> };
> 
> You can see that the foo value is wrong. It's parsed as int, instead of string. Same
> test with the fix:
> 
> / {
>    ...
>     __symbols__ {
>         foo = "/test-node/foo";
>         ...
>     };
> };
> 
> The test-case uses already existing overlays:
>  - stacked_overlay_bar.dts
>  - stacked_overlay_baz.dts
> 
> When comparing existing with actual, the string seems the same, however there is extra character in the end.
> This can be seen with hexdump. Thus an error is returned.
> 
> Changes in v2:
>  - Add test-case
> 
> Stefan Mavrodiev (2):
>   Remove trailing zero from the overlay path
>   Add test-case for trailing zero
> 
>  libfdt/fdt_overlay.c              |  2 +-
>  tests/run_tests.sh                |  4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 

-- 
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: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux