U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: mdio: check argc for extended mode
@ 2026-10-23 22:01 Maxin B. John
  2026-10-26 16:14 ` Simon Glass
  0 siblings, 1 reply; 2+ messages in thread
From: Maxin B. John @ 2026-10-23 22:01 UTC (permalink / raw)
  To: u-boot; +Cc: trini

Check argc before accessing argv[2] in extended MDIO operations
(rx/wx).

Return CMD_RET_USAGE if the PHY device name is missing.

Signed-off-by: Maxin B. John <maxin.john@gmail.com>
---
 cmd/mdio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cmd/mdio.c b/cmd/mdio.c
index c0a87087d315..1d73a77ece35 100644
--- a/cmd/mdio.c
+++ b/cmd/mdio.c
@@ -230,6 +230,9 @@ static int do_mdio(struct cmd_tbl *cmdtp, int flag, int argc,
 	if (strlen(argv[1]) > 1) {
 		op[1] = argv[1][1];
 		if (op[1] == 'x') {
+			if (argc < 3)
+				return CMD_RET_USAGE;
+
 			phydev = mdio_phydev_for_ethname(argv[2]);
 
 			if (phydev) {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cmd: mdio: check argc for extended mode
  2026-10-23 22:01 [PATCH] cmd: mdio: check argc for extended mode Maxin B. John
@ 2026-10-26 16:14 ` Simon Glass
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2026-10-26 16:14 UTC (permalink / raw)
  To: maxin.john; +Cc: u-boot, trini

On 2026-10-23T22:01:33, Maxin B. John <maxin.john@gmail.com> wrote:
> cmd: mdio: check argc for extended mode
>
> Check argc before accessing argv[2] in extended MDIO operations
> (rx/wx).
>
> Return CMD_RET_USAGE if the PHY device name is missing.
>
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
>
>  cmd/mdio.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-26 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 22:01 [PATCH] cmd: mdio: check argc for extended mode Maxin B. John
2026-10-26 16:14 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox