Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1220143pxk; Fri, 4 Sep 2020 04:06:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX7HaKTfNL8hwcMTNodNEDIHZNpfpgqQnxJYHWHwCkUV+q98qenCGCWIhbAQtKVb7CchRy X-Received: by 2002:a17:906:274d:: with SMTP id a13mr7125393ejd.434.1599217572292; Fri, 04 Sep 2020 04:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599217572; cv=none; d=google.com; s=arc-20160816; b=se7LIQRQ9CIC5QSXb5zfSN+HlPUvJKqBOoaDb6/n0oIwcfS081G/kMLhFYwyBdXvi3 KSEfBknPc7JlNbxScs9ZgF2yuDbL87HI4PDHQS6uCNeqtOP4GqQOl7Bj0JL8Uo++XU68 IEyl58AG9ek77ZRn07FvYrbfvjoUaw9H2MT0VgwOeAEx/I39B5R1EcIpoYjdVl4Ey2er TiCzsh1za33RkWwnnqVXsMEC3+3jQmRpoADXc1k2s3hiJ7J7K3+vzT5mb6epSQCj/jTg ma9XxiUNtNs+KwZgdaBOMpVn0IA0iI982jknJM/NNg1gnsdL+W7zgTKRmeXxtPVO9Ny1 Hqfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=JeTa6RxfIx7rXOgIb2lTQwktT6r/h3CmrtIYY4Koiuw=; b=Ke4nXesM+rChTc3W08S0jMIAIbTTYv0hCmL2ZSILSQ8xxho4xSo9Ot609yap/diEva hH/LfvKlYnPX+UVe9kSScsDOzdzXbOftDwcRH8V4C3/5LctRCCWCFd1FJQDQs5jRrPNp dUzP+blLwpS5LM5HNd0AaZBLmHRSSLm2ITVxxJ8qQvmF3c2Fzqv+5Y/ttZjr6QwXblY4 SBcQbMX3LaS1Pi5Lo1nRrmhLEEob9DenfYeOoWgZrAqo8/WFYftoyE2wDNzHx4BFcqmo 9+XrwHKbVOr6xT4kSb/hVcbPHA4Sk+CXPc5jhoCn0KAKgZsDVfCDPXpgOLAAFStShURY qL8w== 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 cd4si3978540ejb.107.2020.09.04.04.05.49; Fri, 04 Sep 2020 04:06:12 -0700 (PDT) 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 S1730090AbgIDLEk (ORCPT + 99 others); Fri, 4 Sep 2020 07:04:40 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:62465 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729969AbgIDLBp (ORCPT ); Fri, 4 Sep 2020 07:01:45 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4BjZVg41TDzB09bR; Fri, 4 Sep 2020 13:01:31 +0200 (CEST) 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 0YGbt2hKdpg2; Fri, 4 Sep 2020 13:01:31 +0200 (CEST) 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 4BjZVg2mZyzB09bP; Fri, 4 Sep 2020 13:01:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9D3E88B81C; Fri, 4 Sep 2020 13:01:32 +0200 (CEST) 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 WBmm3Nj24kyR; Fri, 4 Sep 2020 13:01:32 +0200 (CEST) Received: from po17688vm.idsi0.si.c-s.fr (unknown [10.25.210.31]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6C9C28B81B; Fri, 4 Sep 2020 13:01:32 +0200 (CEST) Received: by po17688vm.idsi0.si.c-s.fr (Postfix, from userid 0) id EECE4653FF; Fri, 4 Sep 2020 11:01:31 +0000 (UTC) Message-Id: In-Reply-To: <94ba5a5138f99522e1562dbcdb38d31aa790dc89.1599216721.git.christophe.leroy@csgroup.eu> References: <94ba5a5138f99522e1562dbcdb38d31aa790dc89.1599216721.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH 2/3] powerpc/uaccess: Switch __patch_instruction() to __put_user_asm_goto() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 4 Sep 2020 11:01:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __patch_instruction() is the only user of __put_user_asm() outside of asm/uaccess.h Switch to the new __put_user_asm_goto() to enable retirement of __put_user_asm() in a later patch. Signed-off-by: Christophe Leroy --- arch/powerpc/lib/code-patching.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index 8c3934ea6220..2333625b5e31 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c @@ -21,21 +21,18 @@ static int __patch_instruction(struct ppc_inst *exec_addr, struct ppc_inst instr, struct ppc_inst *patch_addr) { - int err = 0; - - if (!ppc_inst_prefixed(instr)) { - __put_user_asm(ppc_inst_val(instr), patch_addr, err, "stw"); - } else { - __put_user_asm(ppc_inst_as_u64(instr), patch_addr, err, "std"); - } - - if (err) - return err; + if (!ppc_inst_prefixed(instr)) + __put_user_asm_goto(ppc_inst_val(instr), patch_addr, failed, "stw"); + else + __put_user_asm_goto(ppc_inst_as_u64(instr), patch_addr, failed, "std"); asm ("dcbst 0, %0; sync; icbi 0,%1; sync; isync" :: "r" (patch_addr), "r" (exec_addr)); return 0; + +failed: + return -EFAULT; } int raw_patch_instruction(struct ppc_inst *addr, struct ppc_inst instr) -- 2.25.0