From patchwork Mon Jan 4 16:09:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 59140 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp5445099lbb; Mon, 4 Jan 2016 08:10:48 -0800 (PST) X-Received: by 10.98.42.69 with SMTP id q66mr125582356pfq.72.1451923848833; Mon, 04 Jan 2016 08:10:48 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d3si59818687pas.116.2016.01.04.08.10.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2016 08:10:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aG7hi-0002jf-5t; Mon, 04 Jan 2016 16:09:54 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aG7he-0002PI-6i for linux-arm-kernel@lists.infradead.org; Mon, 04 Jan 2016 16:09:51 +0000 Received: by mail-wm0-x236.google.com with SMTP id f206so145924441wmf.0 for ; Mon, 04 Jan 2016 08:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/H78LeDAKGzpXZYDr6yAGOAtUzfH/YBgHE3WAkyUPOM=; b=DDo8X63LN2l1XFKDWJkoc+m66jWx9m78hezlmyjVM62jjY2H9MxK7/SBoehpnpdbTP uINxUthASDjUEipMDhhVMVTF1GnNylmPYTqG0neLdt3a/e5ZBJuu+51umZEyt689Vx6A cyNn7UvhEjquuOSLRHv8MxzJATGbY/m0vJOt0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/H78LeDAKGzpXZYDr6yAGOAtUzfH/YBgHE3WAkyUPOM=; b=Gjjd8Tc2sMxhJBm/XfMCDOhtbHmKoQh5/d+N/qtX1VgOA4SfjhVunt6WLlVLEzGHqm aJhOlOcKAThg2BztzyIVEU5D4a7nr3qgP6VfhX0OKIgtKab8dUBb/fLj1ymT9IJjkazu 2ePkFVsW1Ne6L794H9joMY2FJPxk3TMh4i7zUTcG3QCSCQlDFBkzvYi8vnBwOkgAEQc1 YZCpsQLFo3MTwyTKBJLCFI9lCa1Vv8wlm3QzvqB1k3v3nLMJhpAGQZ57rl/ojajcFe6+ k82865OzOTpr9Tta+aNOXqs9gTLTJfhknQWlXsgwa1s71pri/XGFkHkEYRAfyX5bvRy5 4CJg== X-Gm-Message-State: ALoCoQkAEddDIH+sBHo/Kh4XZI9uhsljI+DyzeH/AmWGYqHCS/dhxkH40Et1Q8Cc3m0AiB6LNrcocgwT2ytCDVMxSpzrQAC2Ww== X-Received: by 10.194.173.233 with SMTP id bn9mr96768019wjc.1.1451923768578; Mon, 04 Jan 2016 08:09:28 -0800 (PST) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by smtp.gmail.com with ESMTPSA id az6sm86483075wjc.25.2016.01.04.08.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Jan 2016 08:09:27 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com Subject: [PATCH] arm64: fix relocation of movz instruction with negative immediate Date: Mon, 4 Jan 2016 17:09:22 +0100 Message-Id: <1451923762-8387-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160104_080950_468886_C897FBD2 X-CRM114-Status: GOOD ( 12.10 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:236 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The test whether a movz instruction with a signed immediate should be turned into a movn instruction (i.e., when the immediate is negative) is flawed, since the value of imm is always positive. So check sval instead. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index f4bc779e62e8..39e4a29cab50 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c @@ -128,7 +128,7 @@ static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val, * immediate is less than zero. */ insn &= ~(3 << 29); - if ((s64)imm >= 0) { + if (sval >= 0) { /* >=0: Set the instruction to MOVZ (opcode 10b). */ insn |= 2 << 29; } else {