From: Tom Herbert <tom@herbertland.com>
To: <stephen@networkplumber.org>, <netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>, Tom Herbert <tom@herbertland.com>
Subject: [PATCH iproute] ipila: Fixed unitialized variables
Date: Mon, 15 Aug 2016 16:30:22 -0700 [thread overview]
Message-ID: <1471303822-1486672-1-git-send-email-tom@herbertland.com> (raw)
Initialize locator and locator_match to zero and only do
addattr if they have been set.
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
ip/ipila.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/ip/ipila.c b/ip/ipila.c
index c30bdbf..57f8c79 100644
--- a/ip/ipila.c
+++ b/ip/ipila.c
@@ -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,8 +202,11 @@ static int ila_parse_opt(int argc, char **argv, struct nlmsghdr *n,
}
}
- addattr64(n, 1024, ILA_ATTR_LOCATOR_MATCH, locator_match);
- addattr64(n, 1024, ILA_ATTR_LOCATOR, locator);
+ 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)
addattr32(n, 1024, ILA_ATTR_IFINDEX, ifindex);
--
2.8.0.rc2
next reply other threads:[~2016-08-15 23:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 23:30 Tom Herbert [this message]
2016-08-17 20:53 ` [PATCH iproute] ipila: Fixed unitialized variables Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471303822-1486672-1-git-send-email-tom@herbertland.com \
--to=tom@herbertland.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).