From patchwork Mon Jun 13 20:14:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 12880100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 576EDC433EF for ; Mon, 13 Jun 2022 20:19:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 708578D01DA; Mon, 13 Jun 2022 16:19:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 503078D01DB; Mon, 13 Jun 2022 16:19:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 266A18D01D8; Mon, 13 Jun 2022 16:19:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 01ADB8D01CC for ; Mon, 13 Jun 2022 16:19:51 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CDE52350FA for ; Mon, 13 Jun 2022 20:19:51 +0000 (UTC) X-FDA: 79574328582.09.F1D0E3C Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by imf20.hostedemail.com (Postfix) with ESMTP id 555711C007A for ; Mon, 13 Jun 2022 20:19:51 +0000 (UTC) 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 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655151591; a=rsa-sha256; cv=none; b=rND/M3GMYi7qV5jDiTPOh4J/5XD9JXcQD84tgr3GFgfQ3B1/I5tum90Pbkc0WULMH9Cimw Ryq3rjlKzsaRiyKQuYMD3gxWGIbz2BFMK7Rhy+tv7s81ELR236qV59IsfCIItLj6Iztniw vLzOYEkAYCqChxH6ixgW7Kxq12bySq4= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=tNdYTuep; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf20.hostedemail.com: domain of andrey.konovalov@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655151591; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=i8Ujjn8ODA+o6f5+82XskCVtNKiV5I0P+bzfQLYNt08=; b=E7ZxvPNWGVdLYFOtfE6dku4LZanDLXjtib86askkGGgyZcYqWP5/IfW98cA2rMqUKi0dpf hdb7pcKi2dR6Dux1YC73168zVZ2h61rBxvL6S4nSmM/AueBzIiUvJ0t0fZ8wZqUuUGSr45 8LmnNomLOSd1wLhCqGrNdDgheYFzP8E= Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=tNdYTuep; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf20.hostedemail.com: domain of andrey.konovalov@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-Rspam-User: X-Stat-Signature: wjojmt46mi1snc7z55x87x551ezpzzkz X-Rspamd-Queue-Id: 555711C007A X-Rspamd-Server: rspam08 X-HE-Tag: 1655151591-414527 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reported-by: kernel test robot --- 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) {