patch-1.3.6 linux/mm/swap.c

Next file: linux/net/802/p8022.c
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.5/linux/mm/swap.c linux/mm/swap.c
@@ -1229,6 +1229,8 @@
 	return;
 }
 
+#define LONG_ALIGN(x) (((x)+(sizeof(long))-1)&~((sizeof(long))-1))
+
 /*
  * set up the free-area data structures:
  *   - mark all pages MAP_PAGE_RESERVED
@@ -1252,7 +1254,7 @@
 	start_mem = init_swap_cache(start_mem, end_mem);
 	mem_map = (mem_map_t *) start_mem;
 	p = mem_map + MAP_NR(end_mem);
-	start_mem = (unsigned long) p;
+	start_mem = LONG_ALIGN((unsigned long) p);
 	while (p > mem_map)
 		*--p = MAP_PAGE_RESERVED;
 
@@ -1263,7 +1265,7 @@
 		end_mem = (end_mem + ~mask) & mask;
 		bitmap_size = (end_mem - PAGE_OFFSET) >> (PAGE_SHIFT + i);
 		bitmap_size = (bitmap_size + 7) >> 3;
-		bitmap_size = (bitmap_size + sizeof(unsigned long) - 1) & ~(sizeof(unsigned long)-1);
+		bitmap_size = LONG_ALIGN(bitmap_size);
 		free_area_map[i] = (unsigned char *) start_mem;
 		memset((void *) start_mem, 0, bitmap_size);
 		start_mem += bitmap_size;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this