fix iounmap for non page aligned addresses

Message ID 20020709135534.A1155@averell
State New, archived
Headers show
Series
  • fix iounmap for non page aligned addresses
Related show

Commit Message

Andi Kleen July 9, 2002, 11:55 a.m. UTC
Hi Linus,

This fixes a problem introduced by the pageattr ioremap/unmap patches.
iounmap lost the ability to free non page aligned addresses, which
are e.g. used by the bootflag code.  This patch fixes this.

Also fix a potential off by one bug.

-Andi



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

Comments

Hugh Dickins July 9, 2002, 2:16 p.m. UTC | #1
On Tue, 9 Jul 2002, Andi Kleen wrote:
> 
> This fixes a problem introduced by the pageattr ioremap/unmap patches.
> iounmap lost the ability to free non page aligned addresses, which
> are e.g. used by the bootflag code.  This patch fixes this.

Good.

> Also fix a potential off by one bug.

Niggle: changing "< high_memory" to "<= high_memory"?  I think that
change is wrong (though admittedly no wronger than what's in 2.4).

So long as VMALLOC_OFFSET enforces an arbitrary gap of at least 8MB
between high_memory and the vmalloc address area, it doesn't matter.
But one day someone may remove that gap (why not?) to make a few
more addresses available, then "<= high_memory" test could go wrong.

Hugh

> --- linux-work/arch/i386/mm/ioremap.c.~2~	Tue Jun 18 02:13:09 2002
> +++ linux/arch/i386/mm/ioremap.c	Fri Jun 21 14:42:23 2002
> @@ -213,9 +213,9 @@
>  void iounmap(void *addr)
>  { 
>  	struct vm_struct *p;
> -	if (addr < high_memory) 
> +	if (addr <= high_memory) 
>  		return; 
> -	p = remove_kernel_area(addr); 
> +	p = remove_kernel_area(PAGE_MASK & (unsigned long) addr); 
>  	if (!p) { 
>  		printk("__iounmap: bad address %p\n", addr);
>  		return;

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

Patch

--- linux-work/arch/i386/mm/ioremap.c.~2~	Tue Jun 18 02:13:09 2002
+++ linux/arch/i386/mm/ioremap.c	Fri Jun 21 14:42:23 2002
@@ -213,9 +213,9 @@ 
 void iounmap(void *addr)
 { 
 	struct vm_struct *p;
-	if (addr < high_memory) 
+	if (addr <= high_memory) 
 		return; 
-	p = remove_kernel_area(addr); 
+	p = remove_kernel_area(PAGE_MASK & (unsigned long) addr); 
 	if (!p) { 
 		printk("__iounmap: bad address %p\n", addr);
 		return;