Skip to content

Commit

Permalink
ofp-parse: Properly report error for invalid group ID.
Browse files Browse the repository at this point in the history
The inner 'error' shadowed an outer one, so that the error, when set, was
never returned to the caller.

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
  • Loading branch information
blp committed Apr 22, 2015
1 parent 9dd30b0 commit aa6fb07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ofp-parse.c
Expand Up @@ -1356,7 +1356,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command,
if(!strcmp(value, "all")) {
gm->group_id = OFPG_ALL;
} else {
char *error = str_to_u32(value, &gm->group_id);
error = str_to_u32(value, &gm->group_id);
if (error) {
goto out;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/ofproto.at
Expand Up @@ -313,6 +313,11 @@ AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout])
AT_CHECK([STRIP_XIDS stdout], [0], [dnl
OFPST_GROUP_DESC reply (OF1.1):
])

# Negative test.
AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=0xfffffff0],
[1], [], [ovs-ofctl: invalid group id 4294967280
])
OVS_VSWITCHD_STOP
AT_CLEANUP

Expand Down

0 comments on commit aa6fb07

Please sign in to comment.