From owner-freebsd-current@FreeBSD.ORG Sat Nov 29 11:09:43 2014 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE31B92D for ; Sat, 29 Nov 2014 11:09:43 +0000 (UTC) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.233.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DEAD9B6 for ; Sat, 29 Nov 2014 11:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=three; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=OT3iPbth8IhkJBsHAGkmoAmCH3xrZ5FHdHhc4KUdy4c=; b=SJhdrRL3Cwmi6k8KfAuz5KqYE6qoQdUlVKa/MCsyszzdCeut4bNvn4qR4m73XK4ZJxBwXZxLhvWp9UZARHYRGynHC7kPgOieEN+BZNsp/hztjDJz/5Qohw2s3GZUK4vwN7Sj2cjFCbBa5Z6Aa5skK5WYRSmsTW9FKslssjS/ZN6czMr6KyVylt4cPHlf79AYpnxlHAlyDPNxvkej25/t3xfhvD/pquFCppYH5mLQGfUf+vm/O9gPPCjf/wzib5EbewJkSTUoKanbQWtIW3mtpzyh85YoIHgMhlmI+ZJfFO1ze2vi9SDds2EeEJRj9MV9mRCeyYiz+Gq3Z7KHsdIpDW+ETTaklaqMs3TFlvf1eh0AT7jLqogg474Ly2NLva4LsaL13CSCdiaKlYTAIVWBpBsmZryb1HlJESgcb6OsLJOUWKR84viemUKjp23WMxJGl1Yxb76EY4rX6wANpPOYzSKO+tem8ZcFbvhjHk9W/TW18kj9qMVg+nrKU7E5GVf5JVWDN6Jw6g86jlCB2qir7hBGzR9RjmO0OVECHzCG2/6YsA9pc/+lOrCKHKpiyFsU/Su0Zr0pKRCjfX4p0NV6x3KOPJjgiXtW//EqvpYkxO6s4kb2q2th5K9UODRyuTCLrV+M5SuagmbMdvPwvxX9wYvioGOhriJNrg29dMrr9lY=; Received: from light.codelabs.ru (v-light.codelabs.ru [144.206.233.83]) by 0.mx.codelabs.ru with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) id 1XufuF-0003cM-Q6; Sat, 29 Nov 2014 15:09:40 +0400 Date: Sat, 29 Nov 2014 14:09:27 +0300 From: Eygene Ryabinkin To: Konstantin Belousov Subject: Re: [CFR][PATCH] drm2: don't assume that dev->driver->max_ioctl > *dev->driver->compat_ioctls_nr Message-ID: References: <20141128173226.GW17068@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RIYY1s2vRbPFwWeW" Content-Disposition: inline In-Reply-To: <20141128173226.GW17068@kib.kiev.ua> Sender: rea@codelabs.ru Cc: freebsd-current@FreeBSD.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 11:09:44 -0000 --RIYY1s2vRbPFwWeW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Fri, Nov 28, 2014 at 07:32:26PM +0200, Konstantin Belousov wrote: > On Fri, Nov 28, 2014 at 04:29:42PM +0300, Eygene Ryabinkin wrote: > > I noticed that the current ioctl processing code for drm2 implicitely > > assumes that the number of native ioctls is higher than that of 32-bit > > compat ones, so it immediately gives EINVAL when > > nr >=3D dev->driver->max_ioctl. Seems that in future such assumption > > may not be true in all cases. > > I very much doubt that it could become true. Compat32 ioctl cannot > exist without its wider counterpart. OK. > > This can be fixed with the following patch: > > http://codelabs.ru/fbsd/patches/drm2/drm_drv-untangle-32bit-compat.di= ff > >=20 > > Any thoughts on it? > > I think either current way or patch are fine, but why changing something > which is fine ? Because the patched code will work with less assumptions and the patch isn't big or complex and introduces no additional code paths, just rearranges things. It also has more unified logics: if 32-bit compat is present and ioctl fits into its range -- do that. If ioctl fits into the native driver ioctl range -- do that. Otherwise -- bail out with an error. And "if" conditions are more uniform w.r.t. check for value of "nr". --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --RIYY1s2vRbPFwWeW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iL4EABEKAGYFAlR5qWdfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl bnBncC5maWZ0aGhvcnNlbWFuLm5ldDgyRkUwNkJDRDQ5N0MwREU0OUVDNEZGMDE2 QUY5RUFFODE1MkVDRkIACgkQFq+eroFS7Pv61wD/QuMYfukWTEv1tj5fIKkfCmKJ WTDp8BHYWBtYLMGqdvMA/3b4UknfcWCV7Pot5eR8xrg+4Upu2R1XGz65UwTVvn19 =w8yg -----END PGP SIGNATURE----- --RIYY1s2vRbPFwWeW--