Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Sep 2013 19:26:45 GMT
From:      Sven-Thorsten Dietrich <sven@inter-yacht.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/181821: Use unsigned type when indexing into mfchashtbl
Message-ID:  <201309041926.r84JQjYh060913@oldred.freebsd.org>
Resent-Message-ID: <201309041930.r84JU05D041872@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         181821
>Category:       kern
>Synopsis:       Use unsigned type when indexing into mfchashtbl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 04 19:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Sven-Thorsten Dietrich
>Release:        HEAD
>Organization:
Vyatta
>Environment:
>Description:
Several instances of indexing into hash table using int type.
Should always index into hash table using unsigned.
>How-To-Repeat:

>Fix:
See patch

Patch attached with submission follows:

Use unsigned type when indexing into mfchashtbl.
Eliminate rollover problems and consequent out-of-bounds indexes
for size of mfchashtbl > MAXINT.

Signed-off-by: Sven-Thorsten Dietrich <sven@vyatta.com>

Index: netinet/ip_mroute.c
===================================================================
--- netinet/ip_mroute.c	(revision 255189)
+++ netinet/ip_mroute.c	(working copy)
@@ -609,7 +608,7 @@
 if_detached_event(void *arg __unused, struct ifnet *ifp)
 {
     vifi_t vifi;
-    int i;
+    u_long i;
 
     MROUTER_LOCK();
 
@@ -705,7 +704,7 @@
 X_ip_mrouter_done(void)
 {
     vifi_t vifi;
-    int i;
+    u_long i;
     struct ifnet *ifp;
     struct ifreq ifr;
 
@@ -803,7 +802,7 @@
 int
 set_api_config(uint32_t *apival)
 {
-    int i;
+    u_long i;
 
     /*
      * We can set the API capabilities only if it is the first operation
@@ -1439,7 +1438,7 @@
 static void
 expire_upcalls(void *arg)
 {
-    int i;
+    u_long i;
 
     CURVNET_SET((struct vnet *) arg);
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309041926.r84JQjYh060913>