[ovs-dev] [PATCH ovn] ovn-nbctl: Fix using uninitialized direction while removing qos.

Mark Michelson mmichels at redhat.com
Wed May 13 20:05:31 UTC 2020


Acked-by: Mark Michelson <mmichels at redhat.com>

On 5/13/20 1:12 PM, Ilya Maximets wrote:
> GCC 9 complains:
> utilities/ovn-nbctl.c: In function 'nbctl_qos_del':
> utilities/ovn-nbctl.c:2592:15: error: 'direction' may be used uninitialized in
>                                 this function [-Werror=maybe-uninitialized]
>   2592 |              !strcmp(direction, qos->direction)) {
>        |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> If uuid specified along with extra arguments like priority or match,
> code might use uninitialized direction for comparison and probably will
> crash.  Exit early with error since we're not supporting such command
> lines.
> 
> CC: Tao YunXiang <taoyunxiang at cmss.chinamobile.com>
> Fixes: 3aca9a51c276 ("ovn-nbctl.c: Add an optional way to delete QoS by uuid")
> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
> ---
>   utilities/ovn-nbctl.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
> index 67b23108f..f4da7c8ed 100644
> --- a/utilities/ovn-nbctl.c
> +++ b/utilities/ovn-nbctl.c
> @@ -2572,6 +2572,11 @@ nbctl_qos_del(struct ctl_context *ctx)
>           return;
>       }
>   
> +    if (qos_rule_uuid) {
> +        ctl_error(ctx, "uuid must be the only argument");
> +        return;
> +    }
> +
>       int64_t priority;
>       error = parse_priority(ctx->argv[3], &priority);
>       if (error) {
> 



More information about the dev mailing list