From owner-freebsd-stable@FreeBSD.ORG Mon Feb 7 10:22:52 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEFC0106564A for ; Mon, 7 Feb 2011 10:22:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 2ED888FC18 for ; Mon, 7 Feb 2011 10:22:51 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p17AMm7w098865 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 7 Feb 2011 12:22:48 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p17AMm2S078570; Mon, 7 Feb 2011 12:22:48 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p17AMmZR078569; Mon, 7 Feb 2011 12:22:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 7 Feb 2011 12:22:48 +0200 From: Kostik Belousov To: perryh@pluto.rain.com Message-ID: <20110207102248.GP78089@deviant.kiev.zoral.com.ua> References: <4d4fb2fa.1SlxGA2eA/1ZnThg%perryh@pluto.rain.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U/fW6JBK3GqE0Htg" Content-Disposition: inline In-Reply-To: <4d4fb2fa.1SlxGA2eA/1ZnThg%perryh@pluto.rain.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-stable@freebsd.org Subject: Re: minor data-typing error in 8.1 fs/devfs/devfs_vnops.c X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2011 10:22:52 -0000 --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--