[PATCH v2 1/2] cmd: fdt: Fix iteration over elements above index 1 in fdt get

Simon Glass sjg at chromium.org
Wed Nov 23 03:11:09 CET 2022


Always increment both the iterator and pointer into the string
property value by length of the current element + 1 (to cater
for the string delimiter), otherwise the element extracted from
the string property value would be extracted from an offset that
is multiple of the length of the first element, instead of sum
of element lengths until select index.

This fixes 'fdt get value' operation for index above 1 (counting
from index 0).

Acked-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
Fixes: 13982ced2cc ("cmd: fdt: Add support for reading stringlist
property values")
Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
---
V2: - Update commit message, use index above 1 and clarify the
      counting is zero-based
    - Add AB from Heinrich
---
 cmd/fdt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list