Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src



On Wed, Jun 30, 2021 at 06:42:21PM +0900, Rin Okuyama wrote:
 > /home/source/ab/HEAD/src/sys/kern/vfs_vnops.c:357:11: error: 'vp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 >   357 |   *ret_vp = vp;
 >       |   ~~~~~~~~^~~~
 > cc1: all warnings being treated as errors

If this still occurs (may depend on gcc version as usual), the fix is:

Index: sys/kern/vfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
retrieving revision 1.218
diff -u -p -r1.218 vfs_vnops.c
--- sys/kern/vfs_vnops.c	30 Jun 2021 17:51:49 -0000	1.218
+++ sys/kern/vfs_vnops.c	30 Jun 2021 17:53:56 -0000
@@ -214,8 +214,10 @@ vn_open(struct vnode *at_dvp, struct pat
 	l->l_dupfd = 0;
 
 	error = namei(&nd);
-	if (error)
+	if (error) {
+		vp = NULL;
 		goto out;
+	}
 
 	vp = nd.ni_vp;
 

This is the only remaining path I see that the compiler might
reasonably get confused about.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index