[PATCH] adjust size calculation for get_vm_area() in ioremap()context

From: Jan Beulich
Date: Tue Apr 22 2008 - 11:15:36 EST


Short of getting a reply on the query why the argument of fls() here is
missing the decrement, here's a patch to add it (reducing the resulting
size when the incoming size is an exact power of two).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>

---
mm/vmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.25/mm/vmalloc.c 2008-04-17 04:49:44.000000000 +0200
+++ 2.6.25-vm-ioremap-size/mm/vmalloc.c 2008-04-15 10:49:20.000000000 +0200
@@ -214,7 +214,7 @@ static struct vm_struct *__get_vm_area_n

BUG_ON(in_interrupt());
if (flags & VM_IOREMAP) {
- int bit = fls(size);
+ int bit = fls(size - 1);

if (bit > IOREMAP_MAX_ORDER)
bit = IOREMAP_MAX_ORDER;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/