Skip to contentSkip to conversation

adjust size calculation for get_vm_area() in ioremap() context

PATCH New Jan Beulich 1 participant 1 message Apr 22, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 adjust size calculation for get_vm_area() in ioremap() context

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).

Cc James Bottomley <[email protected]>
---
 mm/vmalloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmalloc.c +1 -1
@@ -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;