* [PATCH] mkswap: add run time warning when maximum number of pages is exceeded
@ 2013-08-04 9:59 Sami Kerola
2013-08-05 8:44 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Sami Kerola @ 2013-08-04 9:59 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
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@iki.fi>
---
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);
#ifdef __linux__
if (get_linux_version() >= KERNEL_VERSION(2,3,4))
--
1.8.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mkswap: add run time warning when maximum number of pages is exceeded
2013-08-04 9:59 [PATCH] mkswap: add run time warning when maximum number of pages is exceeded Sami Kerola
@ 2013-08-05 8:44 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-08-05 8:44 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
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@iki.fi>
> ---
> 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@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-05 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-04 9:59 [PATCH] mkswap: add run time warning when maximum number of pages is exceeded Sami Kerola
2013-08-05 8:44 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox