From: York Sun Date: Tue, 13 Jun 2017 16:50:41 +0000 (-0700) Subject: cmd: ethsw: Fix out-of-bounds error X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=31417f0e5abacd754e1d576095e76d0e82327ba7;p=u-boot.git cmd: ethsw: Fix out-of-bounds error The for loop in cmd_keywords_opt_check() seems to use wrong array to set boundary, reported by Coverity analysis. Signed-off-by: York Sun CC: Joe Hershberger CC: Tom Rini CC: Prabhakar Kushwaha Reported-by: Coverity (CID: 163251) Reviewed-by: Tom Rini Acked-by: Joe Hershberger --- diff --git a/cmd/ethsw.c b/cmd/ethsw.c index 491cb8eac3..b600965e8a 100644 --- a/cmd/ethsw.c +++ b/cmd/ethsw.c @@ -915,7 +915,7 @@ static void cmd_keywords_opt_check(const struct ethsw_command_def *parsed_cmd, * check if our command's optional keywords match the optional * keywords of an available command */ - for (i = 0; i < ARRAY_SIZE(ethsw_cmd_def); i++) { + for (i = 0; i < ARRAY_SIZE(cmd_opt_def); i++) { keyw_opt_matched = 0; cmd_keyw_p = &parsed_cmd->cmd_to_keywords[keyw_opt_matched]; cmd_keyw_opt_p = &cmd_opt_def[i].cmd_keyword[keyw_opt_matched];