Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1396374pxb; Mon, 22 Feb 2021 00:11:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6bdLAZ64x12mw4FAKrP6HkzdnJISC8IypgduzubnZTciXJ4pfRYjmHot+N2uGA0/LjgTb X-Received: by 2002:a17:907:d21:: with SMTP id gn33mr19928779ejc.242.1613981469744; Mon, 22 Feb 2021 00:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613981469; cv=none; d=google.com; s=arc-20160816; b=oE6R1yMoIutpc3V2rdi6F9Xoa5zcmMQgGXHaaN21LX7WWFovZK3t4Jzuo77gkW0oJ4 3e9WwurDUu7XclSKo/jNmRwkOdGIQVUyUus5P4lRfFh0eBwLYweJp4+rHKIUox3/D4UK pj3/dYUkA5SeACr6LYGs3jKi91+C+321C3LrgCG21zNL4BZlQKurTxGxp9Axm7KrrxGA FkddafY6SQNrwU3yKEJswUFjDkMIDQL8nVEYYAknACJG/RlzjmZeUL6VdRzxp1UOcI7D qCyq5lBZBisWNVzMTjaAHsC71opLvSXgwG8YCYUoqwodW+X2SLzhj5glKHsbEcNk5tEt yuww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4ZF9vUY2CsLKz7kuuDFD0UWH9WYTZL44sQgQxJcGctA=; b=pNH1EHEl37DpaKgt3dyJOQ5EAR/cHMH/nIBugqXEwwCTuGgYknpJwszltvL1dqvWX7 R416BTXA5LqbeBTtea4I6VOLM9No6/qSAriV9olLAC2E198KLsu3MIOG2JnZmy9f3KqE XBET/9yeHwnDggeWl4J/J8y3a95zON+gvkTucqbHyIor43zXb3dS2P+J+yxUFhoyUkPn 1rw1B8/i5AOjJsJjgLBj7kRnRFb7tkRiNpg73zmqI3Q+9pwCstbPMRvWfc7E5VMhNNco HHFkqGmWkmtNwZILH812tCz3fElPT2FYxh5K25IKBknWi4AsaF/befWXBf1MJOhmZrxf o8IQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t13si2401199eje.700.2021.02.22.00.10.47; Mon, 22 Feb 2021 00:11:09 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230442AbhBVIJE (ORCPT + 99 others); Mon, 22 Feb 2021 03:09:04 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:58731 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbhBVIIy (ORCPT ); Mon, 22 Feb 2021 03:08:54 -0500 X-Originating-IP: 81.185.166.122 Received: from localhost.localdomain (122.166.185.81.rev.sfr.net [81.185.166.122]) (Authenticated sender: alex@ghiti.fr) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 13306C0006; Mon, 22 Feb 2021 08:07:56 +0000 (UTC) From: Alexandre Ghiti To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , Mike Rapoport , kasan-dev@googlegroups.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH] riscv: Pass virtual addresses to kasan_mem_to_shadow Date: Mon, 22 Feb 2021 03:07:34 -0500 Message-Id: <20210222080734.31631-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kasan_mem_to_shadow translates virtual addresses to kasan shadow addresses whereas for_each_mem_range returns physical addresses: it is then required to use __va on those addresses before passing them to kasan_mem_to_shadow. Fixes: b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()") Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/kasan_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c index 4b9149f963d3..6d3b88f2c566 100644 --- a/arch/riscv/mm/kasan_init.c +++ b/arch/riscv/mm/kasan_init.c @@ -148,8 +148,8 @@ void __init kasan_init(void) (void *)kasan_mem_to_shadow((void *)VMALLOC_END)); for_each_mem_range(i, &_start, &_end) { - void *start = (void *)_start; - void *end = (void *)_end; + void *start = (void *)__va(_start); + void *end = (void *)__va(_end); if (start >= end) break; -- 2.20.1