Skip to content

Commit

Permalink
Coverity issue in contrail-controller/acl.cc
Browse files Browse the repository at this point in the history
I have run Coverity on branch R5.0 and it reported
the following issue in
contrail-controller/acl.cc:FirewallPolicyIFNodeToReq()

uninit_use_in_call: Using uninitialized value ace_spec.type
when calling Reverse

I've noticed that type field is indeed set in Reverse() function,
but its value is never checked (for instance, in an if clause).

A solution I have found is to add another field, named NOT_USED,
in enum AclTypeSpec and initialize "type" field with NOT_USED
in  constructor.

Change-Id: I6cbc8063d7ac01644a97edd30cf021d41c8fe303
Closes-Bug: #1777452
Signed-off-by: Anda Nicolae <anicolae@lenovo.com>
  • Loading branch information
Anda Nicolae committed Jun 25, 2018
1 parent a476ce8 commit 16a43ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vnsw/agent/filter/acl_entry_spec.h
Expand Up @@ -104,6 +104,7 @@ struct ActionSpec {
};

typedef enum AclTypeSpec {
NOT_USED = 0,
TERM = 1,
NON_TERM = 2,
} AclTypeSpecT;
Expand All @@ -112,7 +113,7 @@ class AclEntrySpec {
public:
//XXX Any field addition update Reverse API also
//so that bidirectionaly ACL spec can be update
AclEntrySpec(): id(0), src_addr_type(AddressMatch::UNKNOWN_TYPE),
AclEntrySpec(): type(NOT_USED), id(0), src_addr_type(AddressMatch::UNKNOWN_TYPE),
dst_addr_type(AddressMatch::UNKNOWN_TYPE), terminal(true) { }
//AclEntrySpec(const AclEntrySpec &rhs);
typedef boost::uuids::uuid uuid;
Expand Down

0 comments on commit 16a43ce

Please sign in to comment.