Subject: Re: fuword
To: Chris G. Demetriou <cgd@netbsd.org>
From: Jan-Hinrich Fessel <oskar@zippo.unna.ping.de>
List: port-alpha
Date: 03/11/1999 21:04:07
--==_Exmh_355367708P
Content-Type: text/plain; charset=us-ascii

In message <876788ez1w.fsf@redmail.redback.com>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...
Gruesse
       Oskar


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



--==_Exmh_355367708P
Content-Type: application/pgp-signature

-----BEGIN PGP MESSAGE-----
Version: 2.6.3i

iQCVAwUBNughtrA63tqjeAhZAQEOEAQApOrluuZbl2i01zS5uUWlJyyhPClnRET3
AfyOzwEqz112DXnemrYCDefOfRdwn+EcMCxQn5b1qMeAmr84UNXuGIzen0cYqVeD
txvz6cUyQ+f9l/7MMyV1e2ZM0bBNDRLbhlnnI0p+UtXzssoA2cK0UCFW39PZte+P
zSQEgt/o1F0=
=FaZg
-----END PGP MESSAGE-----

--==_Exmh_355367708P--