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

Eric Sandeen sandeen at redhat.com
Tue Apr 8 18:25:03 CDT 2014


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 at redhat.com>
---
 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



More information about the xfs mailing list