Finally a case where clang isn't entirely helpful. Because vp->v_tag
is an enum, clang thinks its value can't be bigger than 15 and that
the vp->v_tag >= nitems(vtags) check is therefore always false. But I
think we want to prevent an out-of-bounds access here if the vnode is
corrupted somehow. Casting to u_int makes the compiler shut up.
ok?
Index: kern/vfs_subr.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_subr.c,v
retrieving revision 1.253
diff -u -p -r1.253 vfs_subr.c
--- kern/vfs_subr.c 16 Sep 2016 03:21:16 -0000 1.253
+++ kern/vfs_subr.c 24 Sep 2016 17:16:52 -0000
@@ -2162,8 +2162,9 @@ vfs_vnode_print(void *v, int full,
struct vnode *vp = v;
(*pr)("tag %s(%d) type %s(%d) mount %p typedata %p\n",
- vp->v_tag >= nitems(vtags)? "<unk>":vtags[vp->v_tag], vp->v_tag,
- vp->v_type >= nitems(vtypes)? "<unk>":vtypes[vp->v_type],
+ (u_int)vp->v_tag >= nitems(vtags)? "<unk>":vtags[vp->v_tag],
+ vp->v_tag,
+ (u_int)vp->v_type >= nitems(vtypes)? "<unk>":vtypes[vp->v_type],
vp->v_type, vp->v_mount, vp->v_mountedhere);
(*pr)("data %p usecount %d writecount %d holdcnt %d numoutput %d\n",