Subject: Re: Upgrade of `struct vnd_ioctl'
To: Bill Studenmund <wrstuden@netbsd.org>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 02/15/2007 14:45:53
--m9cXTJRa/CeSQpib
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 14, 2007 at 12:39:58PM -0800, Bill Studenmund wrote:
[...]
> > Then, with that patch, VNDIOOCSET will not have the intended result...
> > And will write 4 extra bytes in memory or fault, depending on some
> > factors.
> >=20
> > What you need to do in the OVNDIOxxx cases is actually *convert* data
> > (which points to a struct oldvnd_ioctl) into a struct vnd_ioctl.
>=20
> Actually, this time I think we can get away with a little type casting=20
> magic. As I understand it, we are changing the length of the last field,=
=20
> so we need only adjust how we handle it. Note: I'm also assuming we'll no=
t=20
> add more components in the future; if we were to, we should make the=20
> above-suggested change for conversion.
>=20
> 	vio->vnd_size =3D dbtob(((struct vnd_oioctl *)vnd)->sc_size);
>=20
> should work for now.

Okay, so first of all, I'm just back from California, I haven't slept
for 24 hours and spending 11 hours on a plane is not the best way to
get clear ideas.  So please assume good faith :-)

I *think* you're missing the fact that vio is the vnd_ioctl _or_
oldvnd_ioctl struct pointer.  vnd is the considered device's softc.

So whatever gross hack you use around the issue won't guarantee that
you don't end up writing 4 bytes after the end of the actually malloc'd
struct.

IOW, I'd rather see it done the clean way, which is actually not that
much a hassle :-)

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

--m9cXTJRa/CeSQpib
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRdRkEdgoQloHrPnoAQLmdgf/W50V2jmtiyZyTVkwBJ2qdPje8veffHTr
ejdoFGEqE7DxOswQMkpcyiiisK5E2dzq98LZ44AF0AJ8mZ4lPMQCeQC15rOyDyTl
9t6RJCSzgiLjaOxAwJIm+1l5tC+etJmsDd67INRIH/qO3LULiX1pBmohnMsYtpCQ
ng6EvXqJpotvnAT8xAqPscKIFFiTFEYUMhDa3uy8PPjfAG0fF2vMwsMW4P+WiwQZ
C8WX2ZqxMspwlRiZaNuoE9m3NNnZaGCHJ9UUeeClu6tUxQHAdcAzgmJLD9ksAiuy
t/5AKLAT9Wbab6ii8s1xDXFPgv3XhE9mOrk1/V1e5vLe0a50XN+nXw==
=OubB
-----END PGP SIGNATURE-----

--m9cXTJRa/CeSQpib--