[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] device/net_io.c: initialize hash_entp to NULL
From: |
Marin Ramesa |
Subject: |
[PATCH] device/net_io.c: initialize hash_entp to NULL |
Date: |
Mon, 2 Dec 2013 23:30:03 +0100 |
* device/net_io.c (hash_entp): Initialize to NET_HASH_ENTRY_NULL.
---
device/net_io.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/device/net_io.c b/device/net_io.c
index 1958840..40fe8f6 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -324,6 +324,7 @@ struct net_hash_entry {
unsigned int keys[N_NET_HASH_KEYS];
};
typedef struct net_hash_entry *net_hash_entry_t;
+#define NET_HASH_ENTRY_NULL ((net_hash_entry_t)0)
struct kmem_cache net_hash_entry_cache;
@@ -1158,7 +1159,7 @@ net_set_filter(ifp, rcv_port, priority, filter,
filter_count)
net_rcv_port_t infp, my_infp;
net_rcv_port_t nextfp;
net_hash_header_t hhp;
- net_hash_entry_t entp, hash_entp;
+ net_hash_entry_t entp;
net_hash_entry_t *head, nextentp;
queue_entry_t dead_infp, dead_entp;
int i;
@@ -1166,6 +1167,13 @@ net_set_filter(ifp, rcv_port, priority, filter,
filter_count)
io_return_t rval;
boolean_t in, out;
+ /* Initialize hash_entp to NET_HASH_ENTRY_NULL to quiet GCC
+ * warning about uninitialized variable. hash_entp is only
+ * used when match != 0; in that case it is properly initialized
+ * by kmem_cache_alloc().
+ */
+ net_hash_entry_t hash_entp = NET_HASH_ENTRY_NULL;
+
/*
* Check the filter syntax.
*/
--
1.8.1.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] device/net_io.c: initialize hash_entp to NULL,
Marin Ramesa <=