Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp873125iog; Mon, 13 Jun 2022 15:02:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmt+l/TBfENpyBRcKLXexp8BzzSC79TzEDZVURSIgDuR9O/QPx/tXIXQC/2JOML7RheNjH X-Received: by 2002:aa7:990e:0:b0:51f:2b9f:6402 with SMTP id z14-20020aa7990e000000b0051f2b9f6402mr1319557pff.9.1655157758856; Mon, 13 Jun 2022 15:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655157758; cv=none; d=google.com; s=arc-20160816; b=mOsJki26r89PjtolSr5rMy4UmMaHbqwp6jhY6rdDJ4+jxms4DKMlUmjW+9TpMfzZuK ix8WgVxVp+wuD3muplaAm3cK0VPJHilfdY73wytdM+As1jbpH+pKX8/GO+lVuudq6eNp 6rTtI9zDf5ki7OJtca22F8ZElGCeBPX9d8QTjCxSyfv/C72IBHCk+e+WMcVGpdtSGJyr BDrD378OBYcGaW71xsPMGB9gAZ/VIRJzDM77BelbTyd4iQLbvRdf3fO7MZC5OHPhCHX0 DH2e4YFHzIHFq8lm4l+6mhadPGmq/QdyqSTowhEU1r3mHogcF6StLIN0zLYQFnGo6YVE b69g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i8Ujjn8ODA+o6f5+82XskCVtNKiV5I0P+bzfQLYNt08=; b=DbJHN1iSoZX++BeIVS3Hds5I7vBVLzrc7y252cmOtBuBg5iwH2dz5ZeqYpnDMNjjVU Qc4r5zsJmpm/HVOzNtf0CnOksf7EhUWUn3urAo3s7/BqfxVbmxtgPe3gmpVRk0gtNl7E HB7kBV7ifcGAN1c8tX9mnVvjb/vfi9Y0ld2kNKHFUJDJuvOtVp4/PKxG0TdTXAOqlfdf B+VG8PefqXst1q6ZaKdUu/j9bO6fRNOZjUAP38alqHcbVI+uMau4eovCV2cuyS2Gevff Q1uj530hac+kHUN+9MdWNiZGwSLkepBzn5uMy6rtcIshuz9Lsjy+RutGtd5OS0NOEadx 9OIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=tNdYTuep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a170902f39400b00153b2d16543si10010215ple.331.2022.06.13.15.02.22; Mon, 13 Jun 2022 15:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=tNdYTuep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350410AbiFMU5F (ORCPT + 99 others); Mon, 13 Jun 2022 16:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352078AbiFMUyJ (ORCPT ); Mon, 13 Jun 2022 16:54:09 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCCEB1A07A for ; Mon, 13 Jun 2022 13:19:44 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1655151583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i8Ujjn8ODA+o6f5+82XskCVtNKiV5I0P+bzfQLYNt08=; b=tNdYTuepZITenpSdu58grTXSjaXt9OL81buen5Wm+++wlMotQfJq9n+UcKkTTT5gZ+gc4f uF7AU1aiTFH85x0uVzzaLfcIcYPfeoCLX+3KfygTgZO4Vq+i5p7QD74yy+0ekX5HwMhW75 QJqnizRPQmY2NxNZs3S4Cds/DJ8v8dA= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 24/32] kasan: move kasan_addr_to_slab to common.c Date: Mon, 13 Jun 2022 22:14:15 +0200 Message-Id: <5ea6f55fb645405bb52cb15b8d30544ba3f189b0.1655150842.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov Move the definition of kasan_addr_to_slab() to the common KASAN code, as this function is not only used by the reporting code. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 7 +++++++ mm/kasan/report.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 519fd0b3040b..5d5b4cfae503 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -30,6 +30,13 @@ #include "kasan.h" #include "../slab.h" +struct slab *kasan_addr_to_slab(const void *addr) +{ + if ((addr >= (void *)PAGE_OFFSET) && (addr < high_memory)) + return virt_to_slab(addr); + return NULL; +} + depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc) { unsigned long entries[KASAN_STACK_DEPTH]; diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 1dd6fc8a678f..ed8234516bab 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -207,13 +207,6 @@ struct page *kasan_addr_to_page(const void *addr) return NULL; } -struct slab *kasan_addr_to_slab(const void *addr) -{ - if ((addr >= (void *)PAGE_OFFSET) && (addr < high_memory)) - return virt_to_slab(addr); - return NULL; -} - static void describe_object_addr(struct kmem_cache *cache, void *object, const void *addr) { -- 2.25.1