lacp: Avoid valgrind warning in lacp_configure() if custom timing not used.
authorBen Pfaff <blp@nicira.com>
Fri, 9 Dec 2011 21:09:23 +0000 (13:09 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 9 Dec 2011 21:09:23 +0000 (13:09 -0800)
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

index 2b77996..edf7f67 100644 (file)
@@ -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