lkml.org 
[lkml]   [2006]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: 2.6.17-rc5-mm1
From
Date
On Tue, 2006-06-06 at 18:59 +0100, Hugh Dickins wrote:
> Even s390 is okay, isn't it? MartinS's swp_type returns the highest
> type, 31, corresponding to 32 types, as on every other architecture.
> You and I and Martin Bligh would prefer this patch...
>
>
> Remove unnecessary obfuscation from sys_swapon's range check on swap
> type, which blew up causing memory corruption once swapless migration
> made MAX_SWAPFILES no longer 2 ^ MAX_SWAPFILES_SHIFT.
>
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
>
> --- 2.6.17-rc5-mm3/mm/swapfile.c 2006-06-04 11:52:47.000000000 +0100
> +++ linux/mm/swapfile.c 2006-06-06 18:53:40.000000000 +0100
> @@ -1404,7 +1404,7 @@ asmlinkage long sys_swapon(const char __
> * from the initial ~0UL that can't be encoded in either the
> * swp_entry_t or the architecture definition of a swap pte.
> */
> - if (type > swp_type(pte_to_swp_entry(swp_entry_to_pte(swp_entry(~0UL,0))))) {
> + if (type >= MAX_SWAPFILES) {
> spin_unlock(&swap_lock);
> goto out;
> }

As long as nobody will have the smart idea to increase MAX_SWAPFILES to
more than 32 I'm fine with it.

--
blue skies,
Martin.

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH

"Reality continues to ruin my life." - Calvin.


-
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/

\
 
 \ /
  Last update: 2006-06-06 20:08    [from the cache]
©2003-2011 Jasper Spaans