ipila: Fixed unitialized variables

Initialize locator and locator_match to zero and only do
addattr if they have been set.

Signed-off-by: Tom Herbert <tom@herbertland.com>
This commit is contained in:
Tom Herbert 2016-08-15 16:30:22 -07:00 committed by Stephen Hemminger
parent 7e33b09331
commit 2d01b393f4
1 changed files with 7 additions and 4 deletions

View File

@ -149,8 +149,8 @@ static int do_list(int argc, char **argv)
static int ila_parse_opt(int argc, char **argv, struct nlmsghdr *n,
bool adding)
{
__u64 locator;
__u64 locator_match;
__u64 locator = 0;
__u64 locator_match = 0;
int ifindex = 0;
bool loc_set = false;
bool loc_match_set = false;
@ -202,7 +202,10 @@ static int ila_parse_opt(int argc, char **argv, struct nlmsghdr *n,
}
}
if (loc_match_set)
addattr64(n, 1024, ILA_ATTR_LOCATOR_MATCH, locator_match);
if (loc_set)
addattr64(n, 1024, ILA_ATTR_LOCATOR, locator);
if (ifindex_set)