]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: catch unknown format in protofile parsing
authorEric Sandeen <sandeen@redhat.com>
Mon, 14 Apr 2014 06:13:44 +0000 (16:13 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 14 Apr 2014 06:13:44 +0000 (16:13 +1000)
As the code stands today we can't get an unknown format in the
last case statement, but Coverity warns that if we ever do, we'll
use an uninitialized "ip" in the call to libxfs_trans_log_inode().

Adding a default: case to catch unknown formats is defensive and
makes the checker happy.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
mkfs/proto.c

index 95583c90bcb245af4933ce0f5b4211706a7d0976..308325be2f450777a4e241f2e19f161b2abeaf5e 100644 (file)
@@ -591,6 +591,9 @@ parseproto(
                }
                libxfs_iput(ip, 0);
                return;
+       default:
+               ASSERT(0);
+               fail(_("Unknown format"), EINVAL);
        }
        libxfs_trans_log_inode(tp, ip, flags);
        error = libxfs_bmap_finish(&tp, &flist, &committed);