Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1515005ybl; Thu, 22 Aug 2019 16:13:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwljrROQMHmpz85y+QedqxDiRa1nA0XSmzoM2FLi8/UBvXSnnrV/ygpFFgP0/gCF01F09d+ X-Received: by 2002:a17:902:1126:: with SMTP id d35mr1385202pla.330.1566515580232; Thu, 22 Aug 2019 16:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566515580; cv=none; d=google.com; s=arc-20160816; b=SrWCP7QE7sOBFxkh2qT+boF0id2x0ya/cS7o5jbewpvY9BMRg9ZfkaPmNZ8G0KJezu AtT901JL7gbM7ECF19MgPV+qJvIkoLi23sBlzjVPsDS2yC5/LFjHe1hrdv84RCHtEkY5 ZQIvV+buZTF90rQ0yRvCZUAmTAhGC6jEHlC+8uvJLxdLnHuCAaij2f4hkg3tzWRkv5Iv 76e2Eic6phgAqUd696ZfpOtnLH6rR/CNGLdP9bngm5EhkG9HsjXJwnVS9kwpTnjj/DWD Bl3XUeZhD4KFBvZpiV8rJkLD7rVGO9L54JTA02r6TmL9H1WRfabJnQ2aN7TwU1BR3pJ9 nGXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9p92h4C8/GATQwF4Wit0r3kcbO6olvSjGub2nUZBGIQ=; b=UyRfR60sRMxLUrkud1wz2ktv3vhV8J8q1YiNJtBFGWzSUDU/hCmejrWbQ/Hb5MqZow NlS4AsFHqR1ZF8f+3HHSQwwOtrJ1kGUcwoVyrRIToCtE48FVlMkBs/CGEGTFl6TYBEiL V0QOnCXwB/iBU5/yOsqR/mzfY9WGrQ2ZkfkPVUJ1JoLGXP30yyj8Ut0X3VE6gtpEdIE6 oumNad42MoY05B8AjP5tlUj2juqqttydwwqfh11BW08h7I2Mvf29iums9mhceZPLu6iB RIE12Fw97TqXSsFCYXdDspvgIXx2Lf7HVRjhHO6LxvzoG9hC80EBMocAy8cp6UCKJTa5 AgTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="V9RDPz/1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si873400pfr.97.2019.08.22.16.12.45; Thu, 22 Aug 2019 16:13:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="V9RDPz/1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387890AbfHVRN7 (ORCPT + 99 others); Thu, 22 Aug 2019 13:13:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390574AbfHVRI4 (ORCPT ); Thu, 22 Aug 2019 13:08:56 -0400 Received: from sasha-vm.mshome.net (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C23023406; Thu, 22 Aug 2019 17:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566493735; bh=3A6m9fMUKPW0uA/L4zOoMyYo00AiR3KuJVo9+xKS1CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V9RDPz/1wAmFIEaQl2NhgCSPMk5Mju20gZmfQ552c+YfSy7wbYrS304Tjv/w98rP+ 1tTvEEMxrVQC08cE+nFAKg/yZIU858ifFo2jsfr06XE5QkJG2x8VrA0eYDT92d6gX+ cQaWCS0NFB76j8hMYU0c2F8gZXhkm+ypaK60VeDA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Qian Cai , Will Deacon , Sasha Levin Subject: [PATCH 5.2 075/135] arm64/mm: fix variable 'tag' set but not used Date: Thu, 22 Aug 2019 13:07:11 -0400 Message-Id: <20190822170811.13303-76-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822170811.13303-1-sashal@kernel.org> References: <20190822170811.13303-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.2.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.2.10-rc1 X-KernelTest-Deadline: 2019-08-24T17:07+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qian Cai [ Upstream commit 7732d20a160c76006c7fe7bca5178aea6af1d2e8 ] When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a warning, mm/kasan/common.c: In function '__kasan_kmalloc': mm/kasan/common.c:464:5: warning: variable 'tag' set but not used [-Wunused-but-set-variable] u8 tag = 0xff; ^~~ Fix it by making __tag_set() a static inline function the same as arch_kasan_set_tag() in mm/kasan/kasan.h for consistency because there is a macro in arch/arm64/include/asm/kasan.h, #define arch_kasan_set_tag(addr, tag) __tag_set(addr, tag) However, when CONFIG_DEBUG_VIRTUAL=n and CONFIG_SPARSEMEM_VMEMMAP=y, page_to_virt() will call __tag_set() with incorrect type of a parameter, so fix that as well. Also, still let page_to_virt() return "void *" instead of "const void *", so will not need to add a similar cast in lowmem_page_address(). Signed-off-by: Qian Cai Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/memory.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index b7ba75809751e..fb04f10a78ab3 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -210,7 +210,11 @@ extern u64 vabits_user; #define __tag_reset(addr) untagged_addr(addr) #define __tag_get(addr) (__u8)((u64)(addr) >> 56) #else -#define __tag_set(addr, tag) (addr) +static inline const void *__tag_set(const void *addr, u8 tag) +{ + return addr; +} + #define __tag_reset(addr) (addr) #define __tag_get(addr) 0 #endif @@ -301,8 +305,8 @@ static inline void *phys_to_virt(phys_addr_t x) #define page_to_virt(page) ({ \ unsigned long __addr = \ ((__page_to_voff(page)) | PAGE_OFFSET); \ - unsigned long __addr_tag = \ - __tag_set(__addr, page_kasan_tag(page)); \ + const void *__addr_tag = \ + __tag_set((void *)__addr, page_kasan_tag(page)); \ ((void *)__addr_tag); \ }) -- 2.20.1