From: Heinrich Schuchardt Date: Wed, 24 Jan 2018 19:33:54 +0000 (+0100) Subject: efi_loader: catch misspelled bootefi subcommand X-Git-Tag: v2018.03-rc1~11^2~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=49db1cb8c3a2cfaf3cd9d01b630382843e29c48d;p=u-boot efi_loader: catch misspelled bootefi subcommand If 'bootefi hello' or 'bootefi selftest' can be executed depends on the configuration. If an invalid non-numeric 1st argument is passed to bootefi, e.g. 'bootefi hola', this string is converted to 0 and U-Boot jumps to this typically invalid address. With the patch the online help is shown instead. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 545cfecc12..4233d36b72 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -373,6 +373,9 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) saddr = argv[1]; addr = simple_strtoul(saddr, NULL, 16); + /* Check that a numeric value was passed */ + if (!addr && *saddr != '0') + return CMD_RET_USAGE; if (argc > 2) { sfdt = argv[2];