On Thu, Apr 01, 2021 at 10:29:15AM +0800, Gao Xiang wrote: > On Thu, Apr 01, 2021 at 09:58:53AM +0800, lixiaokeng wrote: > > In some case, the cfg->dsunit is 32, the cfg->dswidth is zero > > and cfg->agsize is 6400 in align_ag_geometry. So, the > > (cfg->agsize % cfg->dswidth) will lead to coredump. > > > > Here add check cfg->dswidth. If it is zero, goto validate. > > > > May I ask what's the command line? and is it reproducable on > the latest upstream version? Btw, according to the line number of your patch format, it seems your patch was based on "v4.17.0". May I ask which version you were testing? If so, that is an outdated version, it'd be better to try with latest version first. Thanks, Gao Xiang > > Thanks, > Gao Xiang > > > Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx> > > --- > > mkfs/xfs_mkfs.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c > > index a135e06..71d3f74 100644 > > --- a/mkfs/xfs_mkfs.c > > +++ b/mkfs/xfs_mkfs.c > > @@ -2725,6 +2725,9 @@ _("agsize rounded to %lld, sunit = %d\n"), > > (long long)cfg->agsize, dsunit); > > } > > > > + if (!cfg->dswidth) > > + goto validate; > > + > > if ((cfg->agsize % cfg->dswidth) == 0 && > > cfg->dswidth != cfg->dsunit && > > cfg->agcount > 1) { > > -- > >