From patchwork Wed Jun 28 14:58:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9814699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF8CB60383 for ; Wed, 28 Jun 2017 15:25:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEE9528575 for ; Wed, 28 Jun 2017 15:25:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C21C3285B3; Wed, 28 Jun 2017 15:25:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37F4C28575 for ; Wed, 28 Jun 2017 15:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=PTyDDor+famTXkcvBWyobjqI/GQUM8pozJKotUgRRVA=; b=dM9 Ztgjj5N3cGwD9NKQFGzbJ1hvz2Snvhl2PDYV9K5gr0OgLki0HUwxB/biOeXWV/aiII8K68NQGAUj3 RmAzDrvkfLfsdy5C2VUY397gKM6xSpWssX1RYpjPBFDwpCTPhMDN2CbqHhR0jC2X5yjgkkwAB/+8L 9PhHErRgeHoFDIh/85FyBZ/PhdkZ0s4GXB3T+wuLVYyMEMpIBPX8st6cMv4FAM410tmxDvts4/vx0 Ij9Rn/c1X76C6eb+4gTRPAESkmIUqDKg5Q/BuB8h25GhTOimpB7F8oLZSx/TTyRVCChvCWUoHwikW L1rS6UqUw3XdmmtW1X0iXdHh0ki2W+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dQEq2-0004ks-4O; Wed, 28 Jun 2017 15:25:06 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dQEQL-0004t1-5v for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2017 14:58:36 +0000 Received: by mail-wm0-x244.google.com with SMTP id p204so7191336wmg.1 for ; Wed, 28 Jun 2017 07:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5fJTQmt5Gdytpq+7OOaIn9YEtOG3+Z0tX+Z6olyQrA4=; b=dHw8PvY6CzscmwdxxYKWohvML5GPxfVupPBmor179S45yDPUNzbhZVF/Cvu3Z5QjdJ ZaEGtF1NjO9DzMp9iZPe5GPqwWZM33F6bRTLXQftB9p6SAYv87yMO36o9J/QmqB0Malf 5wKhFwS9NfB8y60ri/H/wBrx31i90Y6KlgPviDqN6uAM8KPU/HchRafOjgUgCV5/03Fq u7+pZfByw2wOQJOUEy7JtFbQu/XDPXdWQpILO21FrIGhD2jym8Lvds/eu3OMPMsYs4Dd TEsmBGJEs5Gqq3/DgU0jllujuIbqhu6eYy8iyvngQiNJQ/V51uJVbNVrvvGcVx7hZW9g fcFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5fJTQmt5Gdytpq+7OOaIn9YEtOG3+Z0tX+Z6olyQrA4=; b=myalf4bbNs+sfI/7VOXTdXzRciBGILGsqEWC4+ioo8zGUORfMs/eieVuyyL4vkK9DS JrgMhCmEaeLZAkpWhzRbB/FkNxDb5KruWg/GBZgWsfrA+wyjc7jOWFrnZLZcmlS3bHLu TERXzNWMfwZQ7yJK/qY150pIxUzQcKVjWxeQeVu96l8WSvdXNlO65AHgEO9hRovgFIqD 5653FT+rPsVgkQu75ywWg8TO7nt9bC+j+5ReMzf73rrvP3d0+/UIdVGX+ywOqN6Wl7hf 8VhvIJhKPSFGP9moM9rO+S8zf0hEaIiuFpxwehUVdrTaJ+3zru2ZYKyFUOEs+LAsJJ90 99CA== X-Gm-Message-State: AKS2vOwB9vNnU9eofZXQgz7DZZ6llRCjM9GXW+8zl9WxlCiDzT/vUwN4 vhQJH2OcHivxiQ== X-Received: by 10.80.162.38 with SMTP id 35mr8079733edl.99.1498661891528; Wed, 28 Jun 2017 07:58:11 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:837:f300:dc41:f6b3:4608:d7c8]) by smtp.gmail.com with ESMTPSA id g55sm1381481edg.66.2017.06.28.07.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 07:58:11 -0700 (PDT) From: Luc Van Oostenryck To: Will Deacon Subject: [PATCH] arm64: fix endianness annotation in aarch64_insn_read() Date: Wed, 28 Jun 2017 16:58:09 +0200 Message-Id: <20170628145809.24675-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170628_075833_574001_A9FEBA3C X-CRM114-Status: GOOD ( 12.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Daniel Borkmann , Suzuki K Poulose , Marc Zyngier , Catalin Marinas , "Luis R. Rodriguez" , Masami Hiramatsu , Luc Van Oostenryck , Laura Abbott , linux-arm-kernel@lists.infradead.org, "David A. Long" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The function arch64_insn_read() is used to read an instruction. On AM64 instructions are always stored in little-endian order and thus the function correctly do a little-to-native endian conversion to the value just read. However, the variable used to hold the value before the conversion is not declared for a little-endian value but for a native one. Fix this by using the correct type for the declaration: __le32 Note: This only works because the function reading the value, probe_kernel_read((), takes a void pointer and void pointers are endian-agnostic. Otherwise probe_kernel_read() should also be properly annotated (or worse, need to be specialized). Signed-off-by: Luc Van Oostenryck --- arch/arm64/kernel/insn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index b884a926a..d4d80b32c 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c @@ -117,7 +117,7 @@ static void __kprobes patch_unmap(int fixmap) int __kprobes aarch64_insn_read(void *addr, u32 *insnp) { int ret; - u32 val; + __le32 val; ret = probe_kernel_read(&val, addr, AARCH64_INSN_SIZE); if (!ret)