From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DC79C32771 for ; Tue, 7 Jan 2020 02:07:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F13662073D for ; Tue, 7 Jan 2020 02:07:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="Tfyl7hLY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F13662073D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47sG3b23w1zDqWF for ; Tue, 7 Jan 2020 13:07:22 +1100 (AEDT) Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47sG1P5j7qzDqT7 for ; Tue, 7 Jan 2020 13:05:29 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="Tfyl7hLY"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 47sG1K0wb1z9sPK; Tue, 7 Jan 2020 13:05:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1578362729; bh=pY6TIy9SR4tEyAS0HbPqGRNPZ2UwwqiyR4Kh28zeFFI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Tfyl7hLYmcqDio6TzmoNX4eEpU/VH1XedfybafyjFJyg/jxoC61dMnx7t5GnDfrfJ Gr7//aHjlvnqj55C8bvTjCcqWFo+aSO1NPh7AsQPq5aFEIKTLm7yKV6qDAcnALHt8h A7VXpu10GywS0S7g2Qj47S6T+C/eV1wQThf24GFD1DUv7X4l/x0a3RumaFeZnoadMp qF7E7AAViYFuxl4ze6gkiOSgHcYuV3D520w4SgqTIh/zS3g1JU6Nt9kTdkUmsq7nrn jzPazOZziHv4zPXU98iZXPnck+e4y7P+Z84onVCXahK4jbpT70RvV1V6lSPbpikXa9 V694qnRtkDCZA== From: Michael Ellerman To: Arnd Bergmann , "James E.J. Bottomley" , "Martin K. Petersen" Subject: Re: [PATCH v3 02/22] compat: provide compat_ptr() on all architectures In-Reply-To: <20200102145552.1853992-3-arnd@arndb.de> References: <20200102145552.1853992-1-arnd@arndb.de> <20200102145552.1853992-3-arnd@arndb.de> Date: Tue, 07 Jan 2020 13:05:22 +1100 Message-ID: <87woa410nx.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Carstens , linux-mips@vger.kernel.org, "James E.J. Bottomley" , Paul Mackerras , "H. Peter Anvin" , sparclinux@vger.kernel.org, Will Deacon , linux-s390@vger.kernel.org, Arnd Bergmann , Paul Burton , Helge Deller , x86@kernel.org, Christian Borntraeger , Ingo Molnar , oprofile-list@lists.sf.net, Catalin Marinas , James Hogan , Robert Richter , Vasily Gorbik , Borislav Petkov , Thomas Gleixner , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Ralf Baechle , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Arnd Bergmann writes: > In order to avoid needless #ifdef CONFIG_COMPAT checks, > move the compat_ptr() definition to linux/compat.h > where it can be seen by any file regardless of the > architecture. > > Only s390 needs a special definition, this can use the > self-#define trick we have elsewhere. > > Signed-off-by: Arnd Bergmann > --- > arch/arm64/include/asm/compat.h | 17 ----------------- > arch/mips/include/asm/compat.h | 18 ------------------ > arch/parisc/include/asm/compat.h | 17 ----------------- > arch/powerpc/include/asm/compat.h | 17 ----------------- > arch/powerpc/oprofile/backtrace.c | 2 +- LGTM. Acked-by: Michael Ellerman (powerpc) One minor comment: > diff --git a/include/linux/compat.h b/include/linux/compat.h > index 68f79d855c3d..11083d84eb23 100644 > --- a/include/linux/compat.h > +++ b/include/linux/compat.h > @@ -958,4 +958,22 @@ static inline bool in_compat_syscall(void) { return false; } > > #endif /* CONFIG_COMPAT */ > > +/* > + * A pointer passed in from user mode. This should not > + * be used for syscall parameters, just declare them > + * as pointers because the syscall entry code will have > + * appropriately converted them already. > + */ > +#ifndef compat_ptr > +static inline void __user *compat_ptr(compat_uptr_t uptr) > +{ > + return (void __user *)(unsigned long)uptr; > +} > +#endif > + > +static inline compat_uptr_t ptr_to_compat(void __user *uptr) > +{ > + return (u32)(unsigned long)uptr; > +} Is there a reason we cast to u32 directly instead of using compat_uptr_t? cheers