Subject: Re: bogon in linux compat code
To: Simon Burge <simonb@wasabisystems.com>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 10/22/2002 13:09:46
This looks right. Good catch!
Jaromir
Simon Burge wrote:
> Currently there's the use of an uninitialised variable in part of the
> linux compat code. The "va" variable is used before it is initalised.
> The following seems right based on what I think the code is doing, but
> I'm not 100% sure. Can anyone double-check this?
>
> Simon.
> --
> Simon Burge <simonb@wasabisystems.com>
> NetBSD Development, Support and Service: http://www.wasabisystems.com/
>
>
> Index: compat/linux/common/linux_ioctl.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/compat/linux/common/linux_ioctl.c,v
> retrieving revision 1.29
> diff -d -p -u -r1.29 linux_ioctl.c
> --- compat/linux/common/linux_ioctl.c 2002/09/06 13:22:52 1.29
> +++ compat/linux/common/linux_ioctl.c 2002/10/22 02:00:28
> @@ -114,17 +114,15 @@ linux_sys_ioctl(p, v, retval)
> struct vnode *vp;
> struct vattr va;
> extern const struct cdevsw sequencer_cdevsw;
> - const struct cdevsw *cdev;
>
> fdp = p->p_fd;
> - cdev = cdevsw_lookup(va.va_rdev);
> if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
> return EBADF;
> if (fp->f_type == DTYPE_VNODE &&
> (vp = (struct vnode *)fp->f_data) != NULL &&
> vp->v_type == VCHR &&
> VOP_GETATTR(vp, &va, p->p_ucred, p) == 0 &&
> - cdev == &sequencer_cdevsw)
> + cdevsw_lookup(va.va_rdev) == &sequencer_cdevsw)
> return oss_ioctl_sequencer(p, (void*)LINUX_TO_OSS(uap),
> retval);
> else
>
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-