Subject: Re: fuword
To: Chris G. Demetriou <>
From: Jan-Hinrich Fessel <>
List: port-alpha
Date: 03/11/1999 21:04:07
Content-Type: text/plain; charset=us-ascii

In message <>you write:
> >         if ((subcmd = fuword(ifr->ifr_data)) == -1)
> >                 return EFAULT;
> > 
> >         if (copyin((caddr_t)ifr->ifr_data, &spr, sizeof spr) != 0)
> >                 return EFAULT;
> (1) copyin does what you want, and probably should be used.

It is, and while looking at the code more deeply :-) I just decided to drop 
fuword entirely and give it a try.

> (2) perhaps i'm missing something, but i can see absolutely no reason
> why you'd want to do the fuword() followed immediately by the
> copyin().  The former is redundant, and wasteful (of both kernel
> space, and execution time 8-).

That's true.  I assume someone wanted to be super-safe in case he was not 
passed the proper struct. But I don't think this would be the right way to do 
that, if it's possible at all.

> if you're worried about efficiency, this is the wrong kind of
> efficiency to worry about, and smacks of unnecessary optimization.

I don't worry, because I'm used to slow machines doing things, well, slow.

> if you're worried about a broken copyin(), beat on the people with the
> broken copyin() to fix their copyin().

I don't have any reason to assume copyin() is broken.

> fuword is fatally flawed in a couple of ways.

I know that, but I just wanted to make as few mods as possible to the code 
that was not written by me...

"The steady state of disks is full."
				-- Ken Thompson

Content-Type: application/pgp-signature

Version: 2.6.3i