From: Michal Simek Date: Mon, 19 Oct 2015 13:13:34 +0000 (+0200) Subject: common: mii: Do not allow to exceed max phy limit X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=bdaeb8f23c6d5d11829072baaf0c0fe37c09f26a;p=u-boot.git common: mii: Do not allow to exceed max phy limit Phy can have addresses 0-31. Check this boundary to ensure that user can't call commands on phy address 32 and more. Signed-off-by: Michal Simek Reviewed-by: Tom Rini --- diff --git a/common/cmd_mii.c b/common/cmd_mii.c index 5e9079da04..7ef7532a50 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -314,6 +314,11 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) mask = simple_strtoul(argv[5], NULL, 16); } + if (addrhi > 31) { + printf("Incorrect PHY address. Range should be 0-31\n"); + return CMD_RET_USAGE; + } + /* use current device */ devname = miiphy_get_current_dev();