Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp510087pxb; Tue, 9 Feb 2021 06:08:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl7pwmniuQUWT15+gh+tqCUioKOzUFwYVWNKhVWmRTHqSLRzmUolUDh5/KVlpOjcPE/5yJ X-Received: by 2002:a50:9dc9:: with SMTP id l9mr22968637edk.377.1612879733881; Tue, 09 Feb 2021 06:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612879733; cv=none; d=google.com; s=arc-20160816; b=DFyfHOZX9nsJrVOWwYKfU6V+lkes/pp41WQo0BEKB391w4SlB0D9lntMn6O7qgJF6D yoo+zSMD9vcoiyPhUcFRGoHZST9x6i5vUknvYmMnct56KFRHsT5+lc91JZTk9ZDqMwkH 63BTS3N/9lkca2w+P4sOHXS1R3aoUiJjMIV9YXI9uTGSdX/2U+qdS3LVJtWgbqJG0k6D jnDPaVHgswZtH6ffX7o/wpfH+RWKxPbV3lP1X6fEO+nmAxVwYi/o0utgipXZQjS8bV9A UFqlo9dxvQx4wKylscLBP0r5LFTy6wpyBZ/Dm/FjmzZi+L9f6LwtBRwRaYmrmFZDO52U usBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:message-id; bh=XLM5Jj7u7Mje287I4HU+c46OGKC3/nU/dt8/UT/ROgw=; b=WQYcFxqVlCirdgjS+fLNWYn0B9AL1BzoU5TEcapOspdAGOEGDBIklD9Pq3kA5xhlbL HFWFem5IUqgLkTSdyaOHHhx6iHzUBkgJ4cxi5Oq3cFi6qEHHyAW2lwp/fuFlqJSI2F0G w77W0Vm1TOtsJB7jlRHMnoIP6Pcm/ksXF2d2ke/j1hXSjxzONkQJkRA4eYGNDacfJU4C sW4n4QmpLZmfbJxILOuiyCsv2B0ulFCMIpvuZhUl6XbjgUglhBPFuLNhDpEPON8VmhjL 8fsycuaA/5rFl9uquhAOlBL/qiHwVCyt3xAMgp2USMLCkM+nHRySJj+j/4KDMY2Jehfk 3OMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si14487874edi.528.2021.02.09.06.08.26; Tue, 09 Feb 2021 06:08:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231913AbhBIOEi (ORCPT + 99 others); Tue, 9 Feb 2021 09:04:38 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:6413 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231874AbhBIODA (ORCPT ); Tue, 9 Feb 2021 09:03:00 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4DZl2D0xCNz9v0KD; Tue, 9 Feb 2021 15:02:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id vzzvUCSzVgen; Tue, 9 Feb 2021 15:02:12 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4DZl2D050pz9v0KB; Tue, 9 Feb 2021 15:02:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2E4838B7EA; Tue, 9 Feb 2021 15:02:13 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id wvj3lYxnwGWG; Tue, 9 Feb 2021 15:02:13 +0100 (CET) Received: from po16121vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E0A908B7E9; Tue, 9 Feb 2021 15:02:12 +0100 (CET) Received: by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 84DEE67359; Tue, 9 Feb 2021 14:02:12 +0000 (UTC) Message-Id: <99d4ccb58a20d8408d0e19874393655ad5b40822.1612879284.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v2 1/3] powerpc/uaccess: get rid of small constant size cases in raw_copy_{to,from}_user() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 9 Feb 2021 14:02:12 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Copied from commit 4b842e4e25b1 ("x86: get rid of small constant size cases in raw_copy_{to,from}_user()") Very few call sites where that would be triggered remain, and none of those is anywhere near hot enough to bother. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 93d33f7e8b53..a4d2569173ac 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -398,26 +398,6 @@ static inline unsigned long raw_copy_from_user(void *to, const void __user *from, unsigned long n) { unsigned long ret; - if (__builtin_constant_p(n) && (n <= 8)) { - ret = 1; - - switch (n) { - case 1: - __get_user_size(*(u8 *)to, from, 1, ret); - break; - case 2: - __get_user_size(*(u16 *)to, from, 2, ret); - break; - case 4: - __get_user_size(*(u32 *)to, from, 4, ret); - break; - case 8: - __get_user_size(*(u64 *)to, from, 8, ret); - break; - } - if (ret == 0) - return 0; - } allow_read_from_user(from, n); ret = __copy_tofrom_user((__force void __user *)to, from, n); @@ -428,27 +408,6 @@ static inline unsigned long raw_copy_from_user(void *to, static inline unsigned long raw_copy_to_user_allowed(void __user *to, const void *from, unsigned long n) { - if (__builtin_constant_p(n) && (n <= 8)) { - unsigned long ret = 1; - - switch (n) { - case 1: - __put_user_size_allowed(*(u8 *)from, (u8 __user *)to, 1, ret); - break; - case 2: - __put_user_size_allowed(*(u16 *)from, (u16 __user *)to, 2, ret); - break; - case 4: - __put_user_size_allowed(*(u32 *)from, (u32 __user *)to, 4, ret); - break; - case 8: - __put_user_size_allowed(*(u64 *)from, (u64 __user *)to, 8, ret); - break; - } - if (ret == 0) - return 0; - } - return __copy_tofrom_user(to, (__force const void __user *)from, n); } -- 2.25.0