Skip to contentSkip to conversation

cmd: mdio: check argc for extended mode

PATCH In review Maxin B. John 3 participants 3 messages Oct 23 – Nov 1

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 cmd/mdio.c | 3 +++
 1 file changed, 3 insertions(+)
cmd/mdio.c +3 -0
index c0a87087d315..1d73a77ece35 100644
@@ -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) {
Signature · 1 line
2.47.3
#2 lore raw
In reply to Maxin B. John
Quoted 6 lines · Maxin B. John

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

Return CMD_RET_USAGE if the PHY device name is missing.

Applied to u-boot/main, thanks!

[1/1] cmd: mdio: check argc for extended mode

      commit: ee9fc27f2a2a43f253a6fe18d7a6f7c4eb0cda3b
Signature · 1 line
Tom