Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3592466rwb; Mon, 5 Sep 2022 14:54:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR4qviRxhhsR/4mS22iIVC1vY7CqTbvhSGPPmQM9LE9SoKtdkKqF9PdC8xtB/johLGH2ehaJ X-Received: by 2002:a17:903:41ce:b0:175:2565:9ddb with SMTP id u14-20020a17090341ce00b0017525659ddbmr32151817ple.161.1662414884816; Mon, 05 Sep 2022 14:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662414884; cv=none; d=google.com; s=arc-20160816; b=fLIwVp6lJUeNU9YPCDUW7x/QQgBQcKWEb0teA8p85EltKHvCUnWRdXwvgMgnhleYvC EO96XCuMPrWo71fusAilUxrQdfAhXlqqnzIx74KrePB+X2WyjE+4BoO0UWPv7npnvQOK qwmMcx3zE4/0yNMPyiUj0zqqUFXp43HWKKlIsyfkrXlGDM3Em8oI3xbK/nDWD13v/ias zpTeYeWwyBpmiC29Q/kXgrmhRRoeeLxrQX1zeG9bG07TgnLoyB8BiTKj4AthAYgWi1ev b5O2TBtYURMRDzKqx7LmZ+qY8CNJh4ePrw2vG7pVOS3m40dJqyALfLIKNsy+8O18z5jX ojVQ== 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=kPlnTXt8NQm9Ac19H9NvNTSg2CSZklYQnAaLBGVcJ14=; b=qVRDIEnpt9n7hnLZbrOD8nDqEazJ1fEQxbfFuOL0sMVrAqiJVB4pFLR38k0ODWKZjw MQCkTNKAp9wZwYBwW1IZAXpy4TNKLrNE2i6401iTbUFTtTg7WWU6s57uL0IHVoc7NrHX 2kg4D5X8sN/dpKuxfDjQy09AGEaj1OvYqNyLJk9frDh54bUMP6htmJDs6ntNLX0Kq2Dt 4XkKrE18wq/yBgTc/ImDnpNZcPYv4TVtbr2lzsdcFX32m/Qysi5Gv1tu/jCHriqBLFtb 5dx17/fO6Ck3F61UNObPb/qt1vx5InrZvBuF8gqB34sM+mjm5VyYmWKwaTxenPNP5KMT r6IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eclOyiHs; 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 p16-20020a056a000b5000b0052b206007bcsi11860782pfo.237.2022.09.05.14.54.33; Mon, 05 Sep 2022 14:54:44 -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=eclOyiHs; 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 S237829AbiIEVLj (ORCPT + 99 others); Mon, 5 Sep 2022 17:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237758AbiIEVLH (ORCPT ); Mon, 5 Sep 2022 17:11:07 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A8F869F6D for ; Mon, 5 Sep 2022 14:10:24 -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=1662412217; 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=kPlnTXt8NQm9Ac19H9NvNTSg2CSZklYQnAaLBGVcJ14=; b=eclOyiHss7QGLs2AZyXGtfKmj7+2ViHesv/WcMVkwMah9whzPZ/nF98WCm44beCM8sIO5l R5HijbXHUE/ZARlJGCDdHtDyY5v2DVn2m+evzXSxVs43wB8c+gfSoeAHghFRa2GyniEA3V gCGBGfHYBCQZ+cPUQKo9jJsCqJXdclU= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm v3 28/34] kasan: rework function arguments in report.c Date: Mon, 5 Sep 2022 23:05:43 +0200 Message-Id: <2e0cdb91524ab528a3c2b12b6d8bcb69512fc4af.1662411799.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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Pass a pointer to kasan_report_info to describe_object() and describe_object_stacks(), instead of passing the structure's fields. The untagged pointer and the tag are still passed as separate arguments to some of the functions to avoid duplicating the untagging logic. This is preparatory change for the next patch. Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 763de8e68887..ec018f849992 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -213,8 +213,8 @@ static inline struct page *addr_to_page(const void *addr) return NULL; } -static void describe_object_addr(struct kmem_cache *cache, void *object, - const void *addr) +static void describe_object_addr(const void *addr, struct kmem_cache *cache, + void *object) { unsigned long access_addr = (unsigned long)addr; unsigned long object_addr = (unsigned long)object; @@ -242,33 +242,32 @@ static void describe_object_addr(struct kmem_cache *cache, void *object, (void *)(object_addr + cache->object_size)); } -static void describe_object_stacks(struct kmem_cache *cache, void *object, - const void *addr, u8 tag) +static void describe_object_stacks(u8 tag, struct kasan_report_info *info) { struct kasan_track *alloc_track; struct kasan_track *free_track; - alloc_track = kasan_get_alloc_track(cache, object); + alloc_track = kasan_get_alloc_track(info->cache, info->object); if (alloc_track) { print_track(alloc_track, "Allocated"); pr_err("\n"); } - free_track = kasan_get_free_track(cache, object, tag); + free_track = kasan_get_free_track(info->cache, info->object, tag); if (free_track) { print_track(free_track, "Freed"); pr_err("\n"); } - kasan_print_aux_stacks(cache, object); + kasan_print_aux_stacks(info->cache, info->object); } -static void describe_object(struct kmem_cache *cache, void *object, - const void *addr, u8 tag) +static void describe_object(const void *addr, u8 tag, + struct kasan_report_info *info) { if (kasan_stack_collection_enabled()) - describe_object_stacks(cache, object, addr, tag); - describe_object_addr(cache, object, addr); + describe_object_stacks(tag, info); + describe_object_addr(addr, info->cache, info->object); } static inline bool kernel_or_module_addr(const void *addr) @@ -296,7 +295,7 @@ static void print_address_description(void *addr, u8 tag, pr_err("\n"); if (info->cache && info->object) { - describe_object(info->cache, info->object, addr, tag); + describe_object(addr, tag, info); pr_err("\n"); } -- 2.25.1