All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute] ipila: Fixed unitialized variables
@ 2016-08-15 23:30 Tom Herbert
  2016-08-17 20:53 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Herbert @ 2016-08-15 23:30 UTC (permalink / raw)
  To: stephen, netdev; +Cc: kernel-team, Tom Herbert

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute] ipila: Fixed unitialized variables
  2016-08-15 23:30 [PATCH iproute] ipila: Fixed unitialized variables Tom Herbert
@ 2016-08-17 20:53 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-08-17 20:53 UTC (permalink / raw)
  To: Tom Herbert; +Cc: netdev, kernel-team

On Mon, 15 Aug 2016 16:30:22 -0700
Tom Herbert <tom@herbertland.com> wrote:

> Initialize locator and locator_match to zero and only do
> addattr if they have been set.
> 
> Signed-off-by: Tom Herbert <tom@herbertland.com>

Applied thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-17 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15 23:30 [PATCH iproute] ipila: Fixed unitialized variables Tom Herbert
2016-08-17 20:53 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.