From: Leo Liang <ycliang@andestech.com>
To: Conor Dooley <conor@kernel.org>
Cc: <u-boot@lists.denx.de>, Conor Dooley <conor.dooley@microchip.com>,
Cyril Jean <cyril.jean@microchip.com>,
Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v1] board: mpfs_icicle: fix board_fit_config_name_match()
Date: Wed, 16 Jul 2025 16:42:47 +0800 [thread overview]
Message-ID: <aHdmB-YrlLB-0kHm@swlinux02> (raw)
In-Reply-To: <20250707121333.601067-2-conor@kernel.org>
On Mon, Jul 07, 2025 at 01:13:33PM +0100, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> The loop in the icicle implementation of board_fit_config_name_match()
> runs strtok() to split off the vendor portion of the compatible string
> using , as the delimiter. strtok() modifies a string in place, so where
> the first config and compatible do not match, the compatible has been
> modified by the time the loop hits the second iteration.
> Since stringlists in dt land are null separated strings, the nulls
> strtok() inserts to replace the delimiter increase the number of strings
> in the compatible list. When the second iteration of the loop calls
> fdt_stringlist_get(), it gets the vendorless portion of the first
> compatible string, rather than the second compatible string. Copy each
> compatible before calling strtok() to avoid this problem.
>
> The temporary string the compatible is copied to is statically
> allocated, as attempts to dynamically allocate it at this stage of boot
> were met with "alloc space exhausted" errors.
>
> Fixes: 7c16ebba1ed ("board: mpfs_icicle: implement board_fdt_blob_setup()/board_fit_config_name_match()")
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> CC: Conor Dooley <conor.dooley@microchip.com>
> CC: Cyril Jean <cyril.jean@microchip.com>
> CC: Tom Rini <trini@konsulko.com>
> CC: Leo Yu-Chi Liang <ycliang@andestech.com>
> CC: u-boot@lists.denx.de
> ---
> board/microchip/mpfs_icicle/mpfs_icicle.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
prev parent reply other threads:[~2025-07-16 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 12:13 [PATCH v1] board: mpfs_icicle: fix board_fit_config_name_match() Conor Dooley
2025-07-16 8:42 ` Leo Liang [this message]
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=aHdmB-YrlLB-0kHm@swlinux02 \
--to=ycliang@andestech.com \
--cc=conor.dooley@microchip.com \
--cc=conor@kernel.org \
--cc=cyril.jean@microchip.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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