From owner-freebsd-bugs@FreeBSD.ORG Wed Sep 4 19:30:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id ABB59327 for ; Wed, 4 Sep 2013 19:30:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8A17D2E3A for ; Wed, 4 Sep 2013 19:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r84JU0lt041873 for ; Wed, 4 Sep 2013 19:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r84JU05D041872; Wed, 4 Sep 2013 19:30:00 GMT (envelope-from gnats) Resent-Date: Wed, 4 Sep 2013 19:30:00 GMT Resent-Message-Id: <201309041930.r84JU05D041872@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sven-Thorsten Dietrich Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B17BE1F9 for ; Wed, 4 Sep 2013 19:26:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E2622E0B for ; Wed, 4 Sep 2013 19:26:45 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r84JQj5t060916 for ; Wed, 4 Sep 2013 19:26:45 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r84JQjYh060913; Wed, 4 Sep 2013 19:26:45 GMT (envelope-from nobody) Message-Id: <201309041926.r84JQjYh060913@oldred.freebsd.org> Date: Wed, 4 Sep 2013 19:26:45 GMT From: Sven-Thorsten Dietrich To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/181821: Use unsigned type when indexing into mfchashtbl X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Sep 2013 19:30:00 -0000 >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 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: