summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2015-10-19 15:13:34 +0200
committerMichal Simek <michal.simek@xilinx.com>2015-11-19 14:03:05 +0100
commitbdaeb8f23c6d5d11829072baaf0c0fe37c09f26a (patch)
tree65233cb93028867ac8bbc3b893dac3bcabd490d5 /common
parentf3bd72801aade1eb74e153bfa57c26f327571475 (diff)
downloadu-boot-imx-bdaeb8f23c6d5d11829072baaf0c0fe37c09f26a.zip
u-boot-imx-bdaeb8f23c6d5d11829072baaf0c0fe37c09f26a.tar.gz
u-boot-imx-bdaeb8f23c6d5d11829072baaf0c0fe37c09f26a.tar.bz2
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 <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_mii.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index 5e9079d..7ef7532 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();