From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbcDUBq1 (ORCPT ); Wed, 20 Apr 2016 21:46:27 -0400 Received: from smtprelay0068.hostedemail.com ([216.40.44.68]:54875 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751604AbcDUBq0 (ORCPT ); Wed, 20 Apr 2016 21:46:26 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3870:3871:4321:5007:6742:7576:7903:10004:10400:10450:10455:10848:11026:11232:11658:11914:12043:12517:12519:12740:13069:13311:13357:13439:13894:14181:14659:14721:19904:19999:21080:30003:30051:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: blood22_19fcea46d3b0e X-Filterd-Recvd-Size: 2185 Message-ID: <1461203176.1918.3.camel@perches.com> Subject: Re: [PATCH 2/3] kernel.h: add u64_to_user_ptr() From: Joe Perches To: Gustavo Padovan , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, Daniel Stone , Arve =?ISO-8859-1?Q?Hj=F8nnev=E5g?= , Riley Andrews , Daniel Vetter , Rob Clark , Greg Hackmann , John Harrison , Maarten Lankhorst , Gustavo Padovan , Andrew Morton , David Airlie , Daniel Vetter Date: Wed, 20 Apr 2016 18:46:16 -0700 In-Reply-To: <1461179926-20542-2-git-send-email-gustavo@padovan.org> References: <1461179926-20542-1-git-send-email-gustavo@padovan.org> <1461179926-20542-2-git-send-email-gustavo@padovan.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-04-20 at 16:18 -0300, Gustavo Padovan wrote: > From: Gustavo Padovan > > This function had copies in 3 different files. Unify them in kernel.h. [] > diff --git a/include/linux/kernel.h b/include/linux/kernel.h [] > @@ -53,6 +53,12 @@ > >  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) >   > +static inline void __user *u64_to_user_ptr(u64 address) > +{ > + typecheck(u64, address); > + return (void __user *)(uintptr_t)address; > +} > + This won't work because by the time address is checked address is already u64 This would need to be something like #define u64_to_user_ptr(x) \ ({ \ typecheck(u64, x); \ u64_to_user_ptr(x); \ })