Re: 2.6.17-rc5-mm1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 6 Jun 2006, Martin Bligh wrote:
> > 
> > I'll go mad if I try to work it out again: I was as worried as you
> > when I discovered that test in sys_swapon a year or so ago, apparently
> > without any check on MAX_SWAPFILES; and went moaning to Andrew.  But
> > once I'd worked through swp_type, pte_to_swp_entry, swp_entry_to_pte,
> > swp_entry, I did come to the conclusion that the MAX_SWAPFILES bound
> > was actually safely built in there.
> 
> If it's that difficult to figure out, is that not reason enough to rip
> it all out and replace it? ;-) Life seems quite complicated enough as
> it is.

Not everyone is as deficient as I am.  But I do agree with you.

I think Martin had good reason to do his "maxpages = swp_offset(....)"
to work out the maximum pgoff expressible in an architecture's swap
offset bits; but just went overboard in doing likewise with swap type.

MAX_SWAPFILES and MAX_SWAPFILES_SHIFT are defined in the common
include/linux/swap.h, and every architecture supports that many
(some could manage more, but swp_type doesn't let them).  If an
architecture came along which somehow couldn't support that many
(seems unlikely to me), then we'd move MAX_SWAPFILES_SHIFT into
into arch-dependent files, wouldn't we?

Yes, I'm all for sys_swapon just saying "if (type >= MAX_SWAPFILES)".

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux