[ovs-dev] [PATCH] lacp: Avoid valgrind warning in lacp_configure() if custom timing not used.

Ben Pfaff blp at nicira.com
Fri Dec 9 21:09:28 UTC 2011


The caller currently doesn't fill in s->custom_time unless it actually
wants a custom LACP time, but lacp_configure() still does a calculation
with it, provoking a warning from valgrind.  This eliminates the warning.

The calculated value was not actually used in this case, so this commit
does not fix a real bug.
---
 lib/lacp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/lacp.c b/lib/lacp.c
index 2b77996..edf7f67 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -243,7 +243,9 @@ lacp_configure(struct lacp *lacp, const struct lacp_settings *s)
 
     lacp->active = s->active;
     lacp->lacp_time = s->lacp_time;
-    lacp->custom_time = MAX(TIME_UPDATE_INTERVAL, s->custom_time);
+    lacp->custom_time = (s->lacp_time == LACP_TIME_CUSTOM
+                         ? MAX(TIME_UPDATE_INTERVAL, s->custom_time)
+                         : 0);
 }
 
 /* Returns true if 'lacp' is configured in active mode, false if 'lacp' is
-- 
1.7.4.4




More information about the dev mailing list