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> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:

committed by
Tom Rini

parent
eb09c33084
commit
aafbe1daa5
@@ -160,6 +160,9 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
char sig[ACPI_NAME_LEN];
|
char sig[ACPI_NAME_LEN];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
name = argv[1];
|
name = argv[1];
|
||||||
if (strlen(name) != ACPI_NAME_LEN) {
|
if (strlen(name) != ACPI_NAME_LEN) {
|
||||||
printf("Table name '%s' must be four characters\n", name);
|
printf("Table name '%s' must be four characters\n", name);
|
||||||
|
Reference in New Issue
Block a user