All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: "Pali Rohár" <pali@kernel.org>, "Bin Meng" <bmeng.cn@gmail.com>,
	"Simon Glass" <sjg@chromium.org>,
	"Marek Behún" <kabel@kernel.org>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH 3/4] pci: Add checks for valid cmdline arguments
Date: Tue, 25 Jan 2022 16:53:21 +0100	[thread overview]
Message-ID: <ccb696d3-b180-d4d2-5a3b-4452a5721048@denx.de> (raw)
In-Reply-To: <20220117153840.31173-4-pali@kernel.org>

On 1/17/22 16:38, Pali Rohár wrote:
> 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>

Thanks,
Stefan

> ---
>   cmd/pci.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/cmd/pci.c b/cmd/pci.c
> index 53edf0d90010..8d2c0c4b43dd 100644
> --- a/cmd/pci.c
> +++ b/cmd/pci.c
> @@ -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) {

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

  reply	other threads:[~2022-01-25 15:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 15:38 [PATCH 0/4] pci: Extend 'pci' and 'pci regions' commands Pali Rohár
2022-01-17 15:38 ` [PATCH 1/4] pci: Fix setting controller's last_busno Pali Rohár
2022-01-25 15:49   ` Stefan Roese
2022-01-29 18:48   ` Tom Rini
2022-01-17 15:38 ` [PATCH 2/4] pci: Extend 'pci regions' command with bus number Pali Rohár
2022-01-25 15:53   ` Stefan Roese
2022-01-25 16:50     ` Pali Rohár
2022-01-26 15:43       ` Stefan Roese
2022-01-29 18:48   ` Tom Rini
2022-01-17 15:38 ` [PATCH 3/4] pci: Add checks for valid cmdline arguments Pali Rohár
2022-01-25 15:53   ` Stefan Roese [this message]
2022-01-29 18:48   ` Tom Rini
2022-01-17 15:38 ` [PATCH 4/4] pci: Extend 'pci' command with bus option '*' Pali Rohár
2022-01-25 15:53   ` Stefan Roese
2022-01-29 18:48   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ccb696d3-b180-d4d2-5a3b-4452a5721048@denx.de \
    --to=sr@denx.de \
    --cc=bmeng.cn@gmail.com \
    --cc=kabel@kernel.org \
    --cc=pali@kernel.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.