xfs
[Top] [All Lists]

[PATCH 13/14] mkfs: catch unknown format in protofile parsing

To: xfs@xxxxxxxxxxx
Subject: [PATCH 13/14] mkfs: catch unknown format in protofile parsing
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Tue, 8 Apr 2014 18:25:03 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1396999504-13769-1-git-send-email-sandeen@xxxxxxxxxx>
References: <1396999504-13769-1-git-send-email-sandeen@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 mkfs/proto.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mkfs/proto.c b/mkfs/proto.c
index 95583c9..308325b 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -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);
-- 
1.7.1

<Prev in Thread] Current Thread [Next in Thread>