Date: Tue, 11 Mar 2014 17:19:40 -0700 From: Conrad Meyer <cemeyer@uw.edu> To: freebsd-hackers@freebsd.org Cc: Conrad Meyer <conrad.meyer@isilon.com>, Jeffrey Roberson <jeff@freebsd.org> Subject: [PATCH 2/5] kern/vfs_syscalls.c: kern_readlinkat: Don't set return value to uninitialized value Message-ID: <1394583583-19023-3-git-send-email-conrad.meyer@isilon.com> In-Reply-To: <1394583583-19023-1-git-send-email-conrad.meyer@isilon.com> References: <1394583583-19023-1-git-send-email-conrad.meyer@isilon.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Struct auio is only initialized in one branch, but we use it to set retval always. This isn't actually a problem because the other case is an error return, so the retval is discarded. However, fixing this reduces Clang static analysis pings, improving code smell. Signed-off-by: Conrad Meyer <conrad.meyer@isilon.com> --- sys/kern/vfs_syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 4be9738..f680d43 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -2553,9 +2553,9 @@ kern_readlinkat(struct thread *td, int fd, char *path, enum uio_seg pathseg, auio.uio_td = td; auio.uio_resid = count; error = VOP_READLINK(vp, &auio, td->td_ucred); + td->td_retval[0] = count - auio.uio_resid; } vput(vp); - td->td_retval[0] = count - auio.uio_resid; return (error); } -- 1.8.5.3
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1394583583-19023-3-git-send-email-conrad.meyer>