aboutsummaryrefslogtreecommitdiff
path: root/cmd/ethsw.c
diff options
context:
space:
mode:
authorYork Sun2017-06-13 09:50:41 -0700
committerTom Rini2017-06-16 10:11:42 -0400
commit31417f0e5abacd754e1d576095e76d0e82327ba7 (patch)
treef49d0fc6dfa4acb51326484e7c271739db26c95a /cmd/ethsw.c
parent19de2deb814a0e4eee0c8ada726a6f9cb698fe57 (diff)
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 <york.sun@nxp.com> CC: Joe Hershberger <joe.hershberger@ni.com> CC: Tom Rini <trini@konsulko.com> CC: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> Reported-by: Coverity (CID: 163251) Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'cmd/ethsw.c')
-rw-r--r--cmd/ethsw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/ethsw.c b/cmd/ethsw.c
index 491cb8eac38..b600965e8ad 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];