]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: fix crc invalidation segfault
authorAnthony Iliopoulos <ailiop@suse.com>
Tue, 26 May 2020 18:35:51 +0000 (14:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 26 May 2020 18:35:51 +0000 (14:35 -0400)
The nowrite_ops var is declared within nested block scope but used
outside that scope, causing xfs_db to crash while trying to defererence
the verify_write pointer. Fix it by lifting the declaration to the outer
scope, where it is accessed.

Fixes: b64af2c48220c8 ("xfs_db: add crc manipulation commands")
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/crc.c

index 95161c6dfe6a557afd790ab86f6956de8f32c6ac..b23417a11a1e661b12829ef377ee251e8a7b503a 100644 (file)
--- a/db/crc.c
+++ b/db/crc.c
@@ -53,6 +53,7 @@ crc_f(
        char            **argv)
 {
        const struct xfs_buf_ops *stashed_ops = NULL;
+       struct xfs_buf_ops nowrite_ops;
        extern char     *progname;
        const field_t   *fields;
        const ftattr_t  *fa;
@@ -127,7 +128,6 @@ crc_f(
        }
 
        if (invalidate) {
-               struct xfs_buf_ops nowrite_ops;
                flist_t         *sfl;
                int             bit_length;
                int             parentoffset;