[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1FB729E1-8CAA-4EEF-ABA4-200471843503@andrew.cmu.edu>
Date: Fri, 30 Sep 2011 00:39:17 -0400
From: Josh Zimmerman <jzimmerm@...rew.cmu.edu>
To: akpm@...ux-foundation.org, serge.hallyn@...onical.com,
ebiederm@...ssion.com, dhowells@...hat.com, daniel.lezcano@...e.fr
Cc: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: [PATCH] kernel/groups.c: Minor bugfix for overflow in binary search
From: Josh Zimmerman
Fixed possible unsigned int overflow bug. (2 + 2^(32) - 1)/2 results in overflow; 2 + (2^(32)-1-2)/2 does not.
Signed-off-by: Josh Zimmerman <joshz@....edu>
---
--- kernel/groups.c.orig 2011-09-29 23:58:45.000000000 -0400
+++ kernel/groups.c 2011-09-29 23:59:13.000000000 -0400
@@ -142,7 +142,7 @@ int groups_search(const struct group_inf
left = 0;
right = group_info->ngroups;
while (left < right) {
- unsigned int mid = (left+right)/2;
+ unsigned int mid = left + (right - left)/2;
if (grp > GROUP_AT(group_info, mid))
left = mid + 1;
else if (grp < GROUP_AT(group_info, mid))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists