[PATCH 1/1] cmd: check argc for acpi dump

'acpi dump' without parameter results in a NULL dereference. Check the number of arguments.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- cmd/acpi.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/cmd/acpi.c b/cmd/acpi.c index 89970417a0..0c14409242 100644 --- a/cmd/acpi.c +++ b/cmd/acpi.c @@ -160,6 +160,9 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc, char sig[ACPI_NAME_LEN]; int ret;
+ if (argc < 2) + return CMD_RET_USAGE; + name = argv[1]; if (strlen(name) != ACPI_NAME_LEN) { printf("Table name '%s' must be four characters\n", name);

On Sat, 9 Dec 2023 at 10:05, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
'acpi dump' without parameter results in a NULL dereference. Check the number of arguments.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
cmd/acpi.c | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
This could have a test in test/dm/acpi.c if you like

On Sat, 9 Dec 2023 at 10:05, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
'acpi dump' without parameter results in a NULL dereference. Check the number of arguments.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
cmd/acpi.c | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
This could have a test in test/dm/acpi.c if you like
Applied to u-boot-dm/next, thanks!
participants (2)
-
Heinrich Schuchardt
-
Simon Glass