[ovs-dev] [PATCH 4/5] pinsched: Avoid uninitialized variable warning.

Jesse Gross jesse at nicira.com
Sun Dec 12 20:47:06 UTC 2010


Some compilers warn about the variable 'n_longest' in drop_packet()
being used uninitialized.  This isn't actually possible but explicitly
set it to zero to avoid spurious warnings.
---
 ofproto/pinsched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c
index dc83558..a307a07 100644
--- a/ofproto/pinsched.c
+++ b/ofproto/pinsched.c
@@ -123,7 +123,7 @@ static void
 drop_packet(struct pinsched *ps)
 {
     struct pinqueue *longest;   /* Queue currently selected as longest. */
-    int n_longest;              /* # of queues of same length as 'longest'. */
+    int n_longest = 0;          /* # of queues of same length as 'longest'. */
     struct pinqueue *q;
 
     ps->n_queue_dropped++;
-- 
1.7.1





More information about the dev mailing list