Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031045AbcCQVd7 (ORCPT ); Thu, 17 Mar 2016 17:33:59 -0400 Received: from smtprelay0180.hostedemail.com ([216.40.44.180]:44193 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933278AbcCQVd5 (ORCPT ); Thu, 17 Mar 2016 17:33:57 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3870:3871:3872:3874:4321:5007:6261:6742:10004:10400:10848:11026:11232:11658:11783:11914:12517:12519:12740:13069:13311:13357:13439:13894:14659:14721:21080:30025:30029:30051:30054:30060:30064:30090: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: shock12_3ecfc95c94b28 X-Filterd-Recvd-Size: 3379 Message-ID: <1458250430.9556.39.camel@perches.com> Subject: Re: [PATCH v9 2/3] kernel.h: add to_user_ptr() From: Joe Perches To: Gustavo Padovan Cc: Rob Clark , Gustavo Padovan , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Greg Kroah-Hartman , Linux Kernel Mailing List , devel@driverdev.osuosl.org, "dri-devel@lists.freedesktop.org" , Daniel Stone , Arve =?ISO-8859-1?Q?Hj=F8nnev=E5g?= , Riley Andrews , Daniel Vetter , Greg Hackmann , John Harrison , Maarten Lankhorst , Andrew Morton , David Airlie , Daniel Vetter , linuxppc-dev Date: Thu, 17 Mar 2016 14:33:50 -0700 In-Reply-To: <20160317211910.GB2611@joana> References: <1458235817-28375-1-git-send-email-gustavo@padovan.org> <1458235817-28375-2-git-send-email-gustavo@padovan.org> <1458236486.9556.11.camel@perches.com> <20160317180523.GA2619@joana> <20160317184318.GA2611@joana> <1458246150.9556.17.camel@perches.com> <1458247207.9556.28.camel@perches.com> <1458249003.9556.30.camel@perches.com> <20160317211910.GB2611@joana> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1-1ubuntu1 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 Content-Length: 1253 Lines: 34 On Thu, 2016-03-17 at 18:19 -0300, Gustavo Padovan wrote: > 2016-03-17 Joe Perches : > > On Thu, 2016-03-17 at 16:50 -0400, Rob Clark wrote: > > > On Thu, Mar 17, 2016 at 4:40 PM, Joe Perches wrote: > > [] > > > > It's a name that seems like it should be a straightforward > > > > cast of a kernel pointer to a __user pointer like: > > > > > > > > static inline void __user *to_user_ptr(void *p) > > > > { > > > > ????????return (void __user *)p; > > > > } > > > ahh, ok.??I guess I was used to using it in the context of ioctl > > > structs..??in that context u64 -> (void __user *) made more sense. > > > > > > Maybe uapi_to_ptr()???(ok, not super-creative.. maybe someone has a > > > better idea) > > Maybe u64_to_user_ptr? > That is a good name. If everyone agrees I can resend this patch > changing it to u64_to_user_ptr. Then should we still keep it on > kernel.h? I've no particular opinion about location, but maybe compat.h might be appropriate. Maybe add all variants: void __user *u32_to_user_ptr(u32 val) void __user *u64_to_user_ptr(u64 val) u32 user_ptr_to_u32(void __user *p) u64 user_ptr_to_u64(void __user *p) Maybe there's something about 32 bit userspace on 64 OS that should be done too.