[ovs-dev] [PATCH] ofp-parse: Properly report error for invalid group ID.
Andy Zhou
azhou at nicira.com
Tue Apr 21 19:45:57 UTC 2015
Acked-by: Andy Zhou <azhou at nicira.com>
On Thu, Apr 16, 2015 at 1:56 PM, Ben Pfaff <blp at nicira.com> wrote:
> 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 at FreeBSD.org>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/ofp-parse.c | 2 +-
> tests/ofproto.at | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
> index 8fce546..4915dde 100644
> --- a/lib/ofp-parse.c
> +++ b/lib/ofp-parse.c
> @@ -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;
> }
> diff --git a/tests/ofproto.at b/tests/ofproto.at
> index 5ae3139..0a54dd9 100644
> --- a/tests/ofproto.at
> +++ b/tests/ofproto.at
> @@ -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
>
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list