Date: Mon, 7 Feb 2011 12:22:48 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: perryh@pluto.rain.com Cc: freebsd-stable@freebsd.org Subject: Re: minor data-typing error in 8.1 fs/devfs/devfs_vnops.c Message-ID: <20110207102248.GP78089@deviant.kiev.zoral.com.ua> In-Reply-To: <4d4fb2fa.1SlxGA2eA/1ZnThg%perryh@pluto.rain.com> References: <4d4fb2fa.1SlxGA2eA/1ZnThg%perryh@pluto.rain.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--U/fW6JBK3GqE0Htg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 07, 2011 at 12:53:14AM -0800, perryh@pluto.rain.com wrote: > Noticed while digging through devfs_read_f() and devfs_write_f() in > the course of investigating some unexpected (by me) geom behavior: >=20 > ... > int ioflag, error, resid; > ... > resid =3D uio->uio_resid; > ... > if (uio->uio_resid !=3D resid || ... >=20 > IOW resid (an int) is being assigned from and compared with > uio->uio_resid (an ssize_t). >=20 > I suppose it's probably harmless on any arch where an (int) is at > least as large as an (ssize_t), but strictly speaking it does look > like a bug -- or am I missing something? The only consequence of resid truncating uio_resid would be failure to update access time for the devfs node, which is probably not a big issue. In fact, HEAD cannot generate request for i/o greater than 4GB anyway. The type of uio_resid was increased from int to ssize_t to not break the KBI and ease indended fix to support full size_t arguments for read(2)/write(2). The change requires lots of careful review, and thus stalled. I integrated your fix into the patch, see http://people.freebsd.org/~kib/misc/uio_resid.4.patch --U/fW6JBK3GqE0Htg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1Px/cACgkQC3+MBN1Mb4g6JQCguJskZ0wfAKVf8TbTC/lUdXVj VKoAoJDyEpSmivQsboqDo9tugfwb5Q6n =v83U -----END PGP SIGNATURE----- --U/fW6JBK3GqE0Htg--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110207102248.GP78089>