lkml.org 
[lkml]   [1998]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] A new version of the sys_swapon bugfix
Date
> |> which is the case in swapfile.c, where swap_header->info.nr_badpages is
> |> unsigned int, thus if it is 0 and we subtract 1, it will result into
> |> 0xffffffff and &swap_header->info.badpages[0xffffffff] is really wrong on
> |> 64bit archs, so the patch is IMHO correct.
>
> Better change
>
> (void *) &swap_header->info.badpages[swap_header->info.nr_badpages-1] >= (void *) swap_header->magic.magic
>
> into
>
> (void *) &swap_header->info.badpages[swap_header->info.nr_badpages] > (void *) swap_header->magic.magic
>
> which avoids the whole problem.

That's not equivalent, as swap_header->magic.magic is not aligned to
sizeof(int), in fact the = is not necessary there at all, it will never be equal.
The alternate change to adding L to the -1 could be:

(void *) (swap_header->info.badpages + swap_header->inf.nr_badpages - 1) > (void *) swap_header->magic.magic

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
Ultralinux - first 64bit OS to take full power of the UltraSparc
Linux version 2.1.126 on a sparc64 machine (498.80 BogoMips).
___________________________________________________________________

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

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.057 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site