Message ID | e27f0e763eeae2de0941a81fa60846b14fd0bf92.1445958209.git.michal.simek@xilinx.com |
---|---|
State | Accepted |
Delegated to: | Michal Simek |
Headers | show |
On Tue, Oct 27, 2015 at 04:03:31PM +0100, Michal Simek wrote: > 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>
diff --git a/common/cmd_mii.c b/common/cmd_mii.c index 5e9079da0487..7ef7532a502a 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();
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> --- common/cmd_mii.c | 5 +++++ 1 file changed, 5 insertions(+)