]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - mm/swapfile.c
mm: try both endianess when checking for endianess
[linux-2.6-omap-h63xx.git] / mm / swapfile.c
index 2da149cfc9accead70439821262dda7d5668815f..67051be7083a090be8bc08b80111a1126cfa5242 100644 (file)
@@ -1582,6 +1582,14 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
                error = -EINVAL;
                goto bad_swap;
        case 2:
+               /* swap partition endianess hack... */
+               if (swab32(swap_header->info.version) == 1) {
+                       swab32s(&swap_header->info.version);
+                       swab32s(&swap_header->info.last_page);
+                       swab32s(&swap_header->info.nr_badpages);
+                       for (i = 0; i < swap_header->info.nr_badpages; i++)
+                               swab32s(&swap_header->info.badpages[i]);
+               }
                /* Check the swap header's sub-version and the size of
                    the swap file and bad block lists */
                if (swap_header->info.version != 1) {