Re: [PATCH] mkswap: add run time warning when maximum number of pages is exceeded

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

 



On Sun, Aug 04, 2013 at 10:59:50AM +0100, Sami Kerola wrote:
> The commit f1477c4 mentioned in manual page swap header has a hard limit
> for usable page count, which user will very likely miss unless there is a
> run time warning.
> 
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  disk-utils/mkswap.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
> index 71503f4..16e7b1e 100644
> --- a/disk-utils/mkswap.c
> +++ b/disk-utils/mkswap.c
> @@ -556,6 +556,9 @@ main(int argc, char **argv) {
>  			(long)(MIN_GOODPAGES * pagesize/1024));
>  		usage(stderr);
>  	}
> +	if (UINT_MAX < PAGES)
> +		warnx(_("warning: swap area exceeds greatest number of supported pages by %llu"),
> +			PAGES - UINT_MAX);

 I don't think this is necessary... what about the "if (PAGES >
 maxpages)" check in the code?

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux