From: Darrick J. Wong Date: Mon, 29 Jul 2024 23:22:34 +0000 (-0700) Subject: xfs_repair: don't crash on -vv X-Git-Tag: v6.10.0~25^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6438c3e740e139adcd6c236606498d49bbb5655;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: don't crash on -vv A user reported a crash in xfs_repair when they run it with -vv specified on the command line. Ultimately this harks back to xfs_m in main() containing uninitialized stack contents, and inadequate null checks. Fix both problems in one go. Reported-by: Santiago Kraus Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/repair/progress.c b/repair/progress.c index 07cf4e4f..74e7a671 100644 --- a/repair/progress.c +++ b/repair/progress.c @@ -394,7 +394,7 @@ timestamp( time_t now; struct tm *tmp; - if (verbose > 1 && mp && mp->m_ddev_targp) + if (verbose > 1 && mp && mp->m_ddev_targp && mp->m_ddev_targp->bcache) cache_report(stderr, "libxfs_bcache", mp->m_ddev_targp->bcache); now = time(NULL); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index cf774964..88aa7554 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -1018,7 +1018,7 @@ main(int argc, char **argv) xfs_mount_t *temp_mp; xfs_mount_t *mp; struct xfs_buf *sbp; - xfs_mount_t xfs_m; + struct xfs_mount xfs_m = { }; struct xlog log = {0}; char *msgbuf; struct xfs_sb psb;