Skip to content

Commit

Permalink
ovn-nbctl: Fix using uninitialized direction while removing qos.
Browse files Browse the repository at this point in the history
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@cmss.chinamobile.com>
Fixes: 3aca9a5 ("ovn-nbctl.c: Add an optional way to delete QoS by uuid")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
igsilya authored and numansiddique committed May 14, 2020
1 parent ad6e787 commit 148dfa4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utilities/ovn-nbctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 148dfa4

Please sign in to comment.