From 6ba50ecdaacbd383ee0362e5e3eab870c5e43ade Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 22 Feb 2010 12:44:19 -0800 Subject: [PATCH] --- yaml --- r: 180728 b: refs/heads/master c: d2e7276b6b5e4bc2148891a056d5862c5314342d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/lib/idr.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 18edea3a6ba4..d1fbff95bade 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 701188374b6f1ef9cf7e4dce4a2e69ef4c0012ac +refs/heads/master: d2e7276b6b5e4bc2148891a056d5862c5314342d diff --git a/trunk/lib/idr.c b/trunk/lib/idr.c index 1cac726c44bc..0dc782216d4b 100644 --- a/trunk/lib/idr.c +++ b/trunk/lib/idr.c @@ -156,10 +156,12 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; /* if already at the top layer, we need to grow */ - if (!(p = pa[l])) { + if (id >= 1 << (idp->layers * IDR_BITS)) { *starting_id = id; return IDR_NEED_TO_GROW; } + p = pa[l]; + BUG_ON(!p); /* If we need to go up one layer, continue the * loop; otherwise, restart from the top.