From: jeffm@suse.com
To: linux-xfs@vger.kernel.org
Cc: Dave Chinner <david@fromorbit.com>,
Eric Sandeen <sandeen@sandeen.net>, Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH] mkfs: fix divide-by-zero in align_ag_geometry
Date: Wed, 20 Jun 2018 22:55:20 -0400 [thread overview]
Message-ID: <20180621025520.9115-1-jeffm@suse.com> (raw)
From: Jeff Mahoney <jeffm@suse.com>
Commit 051b4e37f5e (mkfs: factor AG alignment) factored out the
AG alignment code into a separate function. It got rid of
redundant checks for dswidth != 0 but did too good a job since now
it doesn't check at all. When we hit the check to see if agsize
is a multiple of stripe width: (cfg->agsize % cfg->dswidth), we crash
on a divide by zero.
This patch re-adds the check to the top of align_ag_geometry.
Fixes: 051b4e37f5e (mkfs: factor AG alignment)
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
mkfs/xfs_mkfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 78d0ce5d..28a7e70c 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2670,7 +2670,7 @@ align_ag_geometry(
uint64_t tmp_agsize;
int dsunit = cfg->dsunit;
- if (!dsunit)
+ if (!dsunit || !cfg->dswidth)
goto validate;
/*
--
2.15.1
next reply other threads:[~2018-06-21 2:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 2:55 jeffm [this message]
2018-06-21 3:57 ` [PATCH] mkfs: fix divide-by-zero in align_ag_geometry Dave Chinner
2018-06-21 19:15 ` Jeff Mahoney
2018-06-21 19:26 ` Eric Sandeen
2018-06-21 19:49 ` Dave Chinner
2018-06-21 21:31 ` Jeff Mahoney
2018-06-21 22:36 ` Dave Chinner
2018-06-21 23:16 ` Eric Sandeen
2018-06-22 1:34 ` Eric Sandeen
2018-06-22 1:40 ` Jeff Mahoney
2018-07-19 21:09 ` Jeff Mahoney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180621025520.9115-1-jeffm@suse.com \
--to=jeffm@suse.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox