Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp776422pxb; Tue, 14 Sep 2021 08:29:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzFWHrC6F2bM/TrUqCiZydB3Ww/EGwBB0rSS4D3H3sCnKHg0T26LvWe/y3+TmGgpcmU7ZF X-Received: by 2002:a6b:8f94:: with SMTP id r142mr14187688iod.183.1631633390743; Tue, 14 Sep 2021 08:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631633390; cv=none; d=google.com; s=arc-20160816; b=yOXdB0saVqKgJr4ocBRLYPdeQsYjd3/z73XPpIpmb0MPZc5XWuECMNpH4pPQwmYFD+ RQujM5Pk5aXZr5jsrCLzuBIal5kw5Kzd+S3jK+9Nc0Z7TnCKTw5d2OZGMastNO8a+qB8 CJBKSci/+fsalgrGPD77jTQyKNfAVNR9nxBsdhbKA7XFlA7hZs3AzQVBi0J2qSUrGjVj aK4dykF512pzrFNT2RoGCQvJJwzGsi/n+WU2CWMMyGzP4ZY8rgI6fBCat6iel31vngEu 2I3DG/pnDCjuQEzzvt4b1HPU/nQhPep/8hk2j6Z6v2jLJrUsgd/zvX+LI2BnUzCtMww/ VYpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=wDzluxfrbi4lJ7r1N30QMcqBkQ4zLWoTeslyaNWUCXI=; b=iSzj35g2b6hP41ZtszN1zYGhg72TgnhLL3Bt1r5FYidr079u/BzOepudFJqbjygSfP rLhHhepkLvGn7AmVLpuUhCjyVgsgiI8J+hS1OlNjxQxb0lWFyQjKIo4fbKdou4A/NdlJ dGdsqskNBjihAZaGzX++rCDmctIwi9Zva4GHRCOiHupvJwN20q1ERvkEPHv7WgoPI+XV ompAk+Tr86szSi8uXKi1PdQHxXHDa+PaWevjw4kwSyz+vIan18f8gsvWCcVcVAC7/Jrj SdTKD84wcKaJlNeFQ8po21f0VsnbSjxAnI+zCjpDIV7vz+YQTyQB0m99rDsqPTe5AHh6 KiLQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si10031809ila.10.2021.09.14.08.29.37; Tue, 14 Sep 2021 08:29:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbhINP3U (ORCPT + 99 others); Tue, 14 Sep 2021 11:29:20 -0400 Received: from foss.arm.com ([217.140.110.172]:46260 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233202AbhINP3T (ORCPT ); Tue, 14 Sep 2021 11:29:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0C66D101E; Tue, 14 Sep 2021 08:28:02 -0700 (PDT) Received: from a077416.arm.com (unknown [10.163.44.128]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 82DAB3F5A1; Tue, 14 Sep 2021 08:27:59 -0700 (PDT) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Vincenzo Frascino , Amit Daniel Kachhap , Catalin Marinas , Will Deacon Subject: [PATCH] arm64/traps: Avoid unnecessary kernel/user pointer conversion Date: Tue, 14 Sep 2021 20:57:42 +0530 Message-Id: <20210914152742.27047-1-amit.kachhap@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Annotating a pointer from kernel to __user and then back again might confuse sparse. In call_undef_hook() it can be avoided by not using the intermediate user pointer variable. Note: This patch adds no functional changes to code. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Amit Daniel Kachhap --- arch/arm64/kernel/traps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index b03e383d944a..357d10a8bbf5 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -404,7 +404,8 @@ static int call_undef_hook(struct pt_regs *regs) if (!user_mode(regs)) { __le32 instr_le; - if (get_kernel_nofault(instr_le, (__force __le32 *)pc)) + if (get_kernel_nofault(instr_le, + (__le32 *)instruction_pointer(regs))) goto exit; instr = le32_to_cpu(instr_le); } else if (compat_thumb_mode(regs)) { -- 2.17.1