aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZaur Kambarov <kambarov@berkeley.edu>2005-06-21 20:14:31 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 21:46:12 -0400
commit589777eab7360894b7ca1c4ba9d252e03b51225b (patch)
treed32b8dadc4dc52e81d2b9ffbd03d100b168b41fa /lib
parent3a845099b20e81fb678521f034bbdcd69208da4e (diff)
[PATCH] coverity: idr_get_new_above_int() overrun fix
This patch fixes overrun of array pa: 92 struct idr_layer *pa[MAX_LEVEL]; in 98 l = idp->layers; 99 pa[l--] = NULL; by passing idp->layers, set in 202 idp->layers = layers; to function sub_alloc in 203 v = sub_alloc(idp, ptr, &id); Signed-off-by: Zaur Kambarov <zkambarov@coverity.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/idr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/idr.c b/lib/idr.c
index 81fc430602ee..c5be889de449 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -175,7 +175,7 @@ build_up:
175 * Add a new layer to the top of the tree if the requested 175 * Add a new layer to the top of the tree if the requested
176 * id is larger than the currently allocated space. 176 * id is larger than the currently allocated space.
177 */ 177 */
178 while ((layers < MAX_LEVEL) && (id >= (1 << (layers*IDR_BITS)))) { 178 while ((layers < (MAX_LEVEL - 1)) && (id >= (1 << (layers*IDR_BITS)))) {
179 layers++; 179 layers++;
180 if (!p->count) 180 if (!p->count)
181 continue; 181 continue;