Samuel Thibault wrote:
> It doesn't seem so clear that it's actually always properly initialized.
> We also need a comment explaining why it always is.

* device/net_io.c (hash_entp): Initialize and add a comment saying why this was 
done.

---
 device/net_io.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/device/net_io.c b/device/net_io.c
index 1958840..afa95c5 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -1158,14 +1158,17 @@ 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;
     int                                ret, is_new_infp;
     io_return_t                        rval;
     boolean_t                  in, out;
-
+    net_hash_entry_t           hash_entp = hash_entp; /* 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().
+                                                       */
     /*
      * Check the filter syntax.
      */
-- 
1.8.1.4


Reply via email to