cmd: mdio: check argc for extended mode
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.
Signed-off-by Maxin B. John <[email protected]>
--- cmd/mdio.c | 3 +++ 1 file changed, 3 insertions(+)
cmd/mdio.c +3 -0
@@ -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
Quoted 11 lines · Maxin B. John
cmd: mdio: check argc for extended mode
Check argc before accessing argv[2] in extended MDIO operations (rx/wx).
Return
CMD_RET_USAGEif the PHY device name is missing.Signed-off-by Maxin B. John <[email protected]>cmd/mdio.c | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by Simon Glass <[email protected]>
Quoted 6 lines · Maxin B. John
Check argc before accessing argv[2] in extended MDIO operations (rx/wx).
Return
CMD_RET_USAGEif 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