[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1207332678-10965-1-git-send-email-sandeen@redhat.com>
Date: Fri, 4 Apr 2008 13:11:18 -0500
From: Eric Sandeen <sandeen@...hat.com>
To: linux-ext4@...r.kernel.org
Cc: Eric Sandeen <sandeen@...hat.com>
Subject: [PATCH] Detect too-large stride or stripe-width specification
Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---
misc/mke2fs.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 857d345..144e11a 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -799,13 +799,17 @@ static void parse_extended_opts(struct ext2_super_block *param,
arg++;
}
if (strcmp(token, "stride") == 0) {
+ unsigned long stride;
+
if (!arg) {
r_usage++;
badopt = token;
continue;
}
- param->s_raid_stride = strtoul(arg, &p, 0);
- if (*p || (param->s_raid_stride == 0)) {
+ stride = strtoul(arg, &p, 0);
+ param->s_raid_stride = stride;
+ /* check for invalid or too-large stride */
+ if (*p || (param->s_raid_stride != stride)) {
fprintf(stderr,
_("Invalid stride parameter: %s\n"),
arg);
@@ -814,13 +818,17 @@ static void parse_extended_opts(struct ext2_super_block *param,
}
} else if (strcmp(token, "stripe-width") == 0 ||
strcmp(token, "stripe_width") == 0) {
+ unsigned long stripe_width;
+
if (!arg) {
r_usage++;
badopt = token;
continue;
}
- param->s_raid_stripe_width = strtoul(arg, &p, 0);
- if (*p || (param->s_raid_stripe_width == 0)) {
+ stripe_width = strtoul(arg, &p, 0);
+ param->s_raid_stripe_width = stripe_width;
+ /* check for invalid or too-large stripe width */
+ if (*p || (param->s_raid_stripe_width != stripe_width)) {
fprintf(stderr,
_("Invalid stripe-width parameter: %s\n"),
arg);
--
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists