Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp22096043ybl; Mon, 6 Jan 2020 18:06:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyE8u5oBFNxXh0IykYN0t2Y/OTFOI/V12tImNpVDIRtlxElv2gJ4ihOT/he9ORtk3mfWJPy X-Received: by 2002:a05:6830:155a:: with SMTP id l26mr3717116otp.339.1578362785480; Mon, 06 Jan 2020 18:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578362785; cv=none; d=google.com; s=arc-20160816; b=E8VdXQxGhONdVr3LCn+tozpzFYBlm6m7bQVdvzFrEAk9myr2bwW2n2K7+idcYFo5QM pO8IuQv5TUhOIzfY35vQSwIKkIR+RSKaPxGCnbT8UuyCZaa5OfQUdYEOU39FzKAFFYa5 yvqwdb4JiOdF1QPZHfbVx7wXYHqey5RayfJPBT/MRjq8j7HA6DZZrYMh+NVWPBcaloKH ykq738nHhiHiK9M5u1jtXy+G4TCxC+LjDAoPmy/uo91tMYeviO5c/5U9WQ0lOv9xgLEp bgGRiR1z3F0+ieDkSdiiydHeuTwXYwK8owV3nUF5LZWho2QXk74K8rKI13WfEuNDygpP VkiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=93jatWr+mobo7mP5A6Bcc7QfUdmm7LGuB15fFAFX22I=; b=UIsjAJ715OTYKPdliM1/1BkC1FaHrM5TJgLDSx/1Ldd6PfVQGF/eV1JpGLwbD3a6iU LYhU9auNSQbs7PX0mi9xDQMiB29QYkkWgPXsXUhyl5f+opY3408VCMChpWQdZonSWy4F MUVgw1BmGVrs4LB7OBUcv+1UCNgAKxZBF1DVCGs9ykEAqLyDVcEH/tFX6ivuv87F5OXp mKvS9UD28wVfe4VxVsFjSjs2i9obUfL+zMJPQOQ+dtPPkKjuOMEpfxjHTWXwrXnjMwYh RCvnoEOuE8QQW/avqCi8fHQJ/+SPJMWUGP3wDI/y55NHI4/+WxUwFzdj+mxxB2QkJwRT uWIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Tfyl7hLY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w131si32048768oie.47.2020.01.06.18.06.13; Mon, 06 Jan 2020 18:06:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Tfyl7hLY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727465AbgAGCFc (ORCPT + 99 others); Mon, 6 Jan 2020 21:05:32 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:38625 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727250AbgAGCFc (ORCPT ); Mon, 6 Jan 2020 21:05:32 -0500 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" Cc: Arnd Bergmann , Catalin Marinas , Will Deacon , Ralf Baechle , Paul Burton , James Hogan , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Robert Richter , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, oprofile-list@lists.sf.net, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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