NetBSD Problem Report #18917

Received: (qmail 19839 invoked by uid 605); 4 Nov 2002 09:27:19 -0000
Message-Id: <200211040927.gA49RFH18836@pl374.nas911.nara.nttpc.ne.jp>
Date: Mon, 4 Nov 2002 18:25:57 +0900 (JST)
From: itohy@netbsd.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: itohy@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: use of uninitialized variable in nfs/nfs_vfsops.c::nfs_mount()
X-Send-Pr-Version: 3.95

>Number:         18917
>Category:       kern
>Synopsis:       use of uninitialized variable in nfs/nfs_vfsops.c::nfs_mount()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 04 09:28:00 +0000 2002
>Closed-Date:    Thu Apr 10 12:12:29 +0000 2003
>Last-Modified:  Thu Apr 10 12:12:29 +0000 2003
>Originator:     ITOH Yasufumi
>Release:        NetBSD 1.6K (Nov. 4, 2002)
>Organization:
>Environment:
System: NetBSD illusion.my.domain 1.6K NetBSD 1.6K (ILLUSION.test) #429: Mon Nov 4 18:06:03 JST 2002 itohy@pino.my.domain:/w/src/sys/arch/dreamcast/compile/ILLUSION.test dreamcast
Architecture: sh3el
Machine: dreamcast
>Description:
	The variable "sa" possibly used uninitialized
	in nfs/nfs_vfsops.c::nfs_mount(), if args.addr == NULL.
	I'm not sure if the case actually occurs.

int
nfs_mount(mp, path, data, ndp, p)
	struct mount *mp;
	const char *path;
	void *data;
	struct nameidata *ndp;
	struct proc *p;
{
	int error;
	struct nfs_args args;
	struct mbuf *nam;
	struct nfsmount *nmp = VFSTONFS(mp);
	struct sockaddr *sa;
	struct vnode *vp;
	char *pth, *hst;
	size_t len;
	u_char *nfh;

	error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args));
	if (error)
		return (error);

	if (mp->mnt_flag & MNT_GETARGS) {

		if (nmp == NULL)
			return (EIO);
		if (args.addr != NULL) {
			sa = mtod(nmp->nm_nam, struct sockaddr *);
			error = copyout(sa, args.addr, sa->sa_len);
			if (error)
				return (error);
		}
		args.version = NFS_ARGSVERSION;
		args.addrlen = sa->sa_len;		<==== here
		args.sotype = nmp->nm_sotype;
		args.proto = nmp->nm_soproto;
	...

>How-To-Repeat:
	1. try to compile without -Wno-uninitialized,
	2. look at the code.

>Fix:
	unknown

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: yamt 
State-Changed-When: Thu Apr 10 05:11:50 PDT 2003 
State-Changed-Why:  
this was already fixed. 
(nfs_vfsops.c rev.1.120) 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.