From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752456AbdLKJlV (ORCPT ); Mon, 11 Dec 2017 04:41:21 -0500 Received: from smtp-out4.electric.net ([192.162.216.182]:62389 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbdLKJlT (ORCPT ); Mon, 11 Dec 2017 04:41:19 -0500 From: David Laight To: "'Kees Cook'" CC: Jason Ekstrand , Chris Wilson , "intel-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] drm/i915: Use copy_from_user() in fence copying Thread-Topic: [PATCH] drm/i915: Use copy_from_user() in fence copying Thread-Index: AQHTbtDlKQvHN6piYkuli9t0F+yfhaM5PI2AgAC3vYCAA/XKsA== Date: Mon, 11 Dec 2017 09:41:35 +0000 Message-ID: References: <20171206202850.GA38365@beast> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vBB9fQpR013865 From: Kees Cook > Sent: 08 December 2017 21:10 > >> There's no good reason to separate the access_ok() from the copy, > >> especially since the access_ok() size is hard-coded instead of using > >> sizeof(). Instead, just use copy_from_user() directly. > > > > Looks like an optimisation to save doing the access_ok() check > > for every 'fence'. > > If it really makes a difference, okay, but access_ok() checks are fast. :P Not compared to get_user() :-) David