From patchwork Wed May 24 09:56:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 100424 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp194372qge; Wed, 24 May 2017 02:57:52 -0700 (PDT) X-Received: by 10.84.130.106 with SMTP id 97mr28231762plc.121.1495619872399; Wed, 24 May 2017 02:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495619872; cv=none; d=google.com; s=arc-20160816; b=q7Rps/GptmZD7g/cHLQJJdauIHiS9ioIgETmwvZKR3vSFuzfC6s3cjaH9njA/BdfhR klhbr04FFVyi8wM3J4qZHIJfMCyQdBmL/y8ShmLWEfrX7SjAvY3L7qTdvBAoqrMi1ALB MXi5eUlN9nefBf9Yy9SX1XthfAzb8Jpb/NHmuWNMqqkIbSXQCa05hG7pOtW+x2o5jT0y V0TJ7MBP9TS1rekshAeFRZINiSAyqY8eYdxoK9Uv2ym7nfo9guVc0cGYvW0v2aXWCoFT EGvNLkcZTJq7xdQAD4SX2FRd+tnzmvFPhkOoUH7Frh+lhRhU55lmjb5uCAy+adeCH9VZ ruEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=btWmPMKP3o909BFwaGWMVle9/oMgVA98KPi+lZ03z28=; b=0CoZao6utu/g2t+A7ml0pID8lxMdcR60XsXT5vRcTXl90zbNcQB932DtNI7ILm15GH QG/Y6WG1fzQWg9Oj+HSPETlfeMQ2ocrf8csqKY72YDrfXbigYcouMbupklPtbfff4AUO GtMW7zgvt7X7izdztPEO9GMk4Rg6YTiMKRzht9CmqUW/LONJ2XivnRUwmgcjzdz9XB1c 19cjxBOHtwbEL9LTmBZGB2V0M7HzFpLbLMva/VhzD/BXjFwslrm/XFhLboB5yb3LL3AB tPfp4epJjIiOJPaUe6C2XTJsnUmAqO4HokbJQn9VKgDnenV+bO3ZziV0ip0xVpCEQ7e+ U9Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 b14si24020874pfm.401.2017.05.24.02.57.52; Wed, 24 May 2017 02:57:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751733AbdEXJ5i (ORCPT + 6 others); Wed, 24 May 2017 05:57:38 -0400 Received: from foss.arm.com ([217.140.101.70]:35180 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1035005AbdEXJ5g (ORCPT ); Wed, 24 May 2017 05:57:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C5B262B; Wed, 24 May 2017 02:57:30 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4E0053F578; Wed, 24 May 2017 02:57:30 -0700 (PDT) From: Mark Rutland To: stable@vger.kernel.org Subject: [PATCH v4.4.y] arm64: armv8_deprecated: ensure extension of addr Date: Wed, 24 May 2017 10:56:49 +0100 Message-Id: <1495619809-24764-1-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit 55de49f9aa17b0b2b144dd2af587177b9aadf429 upstream. Our compat swp emulation holds the compat user address in an unsigned int, which it passes to __user_swpX_asm(). When a 32-bit value is passed in a register, the upper 32 bits of the register are unknown, and we must extend the value to 64 bits before we can use it as a base address. This patch casts the address to unsigned long to ensure it has been suitably extended, avoiding the potential issue, and silencing a related warning from clang. Fixes: bd35a4adc413 ("arm64: Port SWP/SWPB emulation support from arm") Cc: # 3.19.x- Acked-by: Will Deacon Signed-off-by: Mark Rutland Signed-off-by: Catalin Marinas --- arch/arm64/kernel/armv8_deprecated.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c index 937f5e5..478a00b 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -305,7 +305,8 @@ static void register_insn_emulation_sysctl(struct ctl_table *table) ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, \ CONFIG_ARM64_PAN) \ : "=&r" (res), "+r" (data), "=&r" (temp) \ - : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT) \ + : "r" ((unsigned long)addr), "i" (-EAGAIN), \ + "i" (-EFAULT) \ : "memory") #define __user_swp_asm(data, addr, res, temp) \