diff options
author | Pali Rohár <pali@kernel.org> | 2022-01-17 16:38:39 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-01-28 17:58:41 -0500 |
commit | 6850a5a8e24fc2345348dd9a160abd7a8e7f1b72 (patch) | |
tree | c05e551736cbb637a5036b62dadb74e5cb91dd70 | |
parent | 39320935cc5a0544768ff6a0e1143313355c6b4d (diff) | |
download | u-boot-6850a5a8e24fc2345348dd9a160abd7a8e7f1b72.zip u-boot-6850a5a8e24fc2345348dd9a160abd7a8e7f1b72.tar.gz u-boot-6850a5a8e24fc2345348dd9a160abd7a8e7f1b72.tar.bz2 |
pci: Add checks for valid cmdline arguments
Currently pci command ignores invalid cmdline arguments and do something.
Add checks that all passed arguments were processed.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r-- | cmd/pci.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -523,7 +523,12 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } if (argc > 2 || (argc > 1 && cmd != 'r' && argv[1][0] != 's')) { busnum = hextoul(argv[argc - 1], NULL); + argc--; } + if (cmd == 'r' && argc > 2) + goto usage; + else if (cmd != 'r' && (argc > 2 || (argc == 2 && argv[1][0] != 's'))) + goto usage; } ret = uclass_get_device_by_seq(UCLASS_PCI, busnum, &bus); if (ret) { |