[PATCH 05/32] cmd: fdt: Check argc before accessing argv in fdt bootcpu

Simon Glass sjg at chromium.org
Wed Mar 1 16:02:02 CET 2023


On Mon, 27 Feb 2023 at 12:55, Marek Vasut
<marek.vasut+renesas at mailbox.org> wrote:
>
> On case 'fdt bootcpu' is invoked without parameters, argv[2] is not
> valid and this command would SEGFAULT in sandbox environment. Add
> missing argc test to avoid the crash and rather print usage help
> message.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> ---
>  cmd/fdt.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Yes sandbox is good for finding this sort of thing.

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list