Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp873316iog; Mon, 13 Jun 2022 15:02:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1srRwNVD2FtZ7eI2CqHAAM0orYmDgLmlq1Z6zr+UvRZAqG95YZD9AUhBpCYaBSuOaVeZWgX X-Received: by 2002:a17:90a:c385:b0:1e3:50ed:e4 with SMTP id h5-20020a17090ac38500b001e350ed00e4mr873529pjt.127.1655157772383; Mon, 13 Jun 2022 15:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655157772; cv=none; d=google.com; s=arc-20160816; b=MzHaEfDm80paF3t1dABvGOgkGA29+fi7VO1klSX0P5QE88E1OACuj05eeTDdD+hCQd 6QNY9XinDJv4qhnk2WTR19z+9fWCOwexuB6tAVyCw+u7zlRCVntfyI1zUHnttwLD8I1V 7tngF7V/oQhumJ1YFqAAo72YPkFuzPtrsbKTxtee0xM+6MpsR704kxHuoKmCJslFMiQJ 75UDCCv4TdcTmG4fkFkHgwcfJTHZIiuiiIgKWuZjydGsjYg0fHpAiKahU1t3OjW6MExt EznOzjOA1XkzZWaksuZvZ7n1GAoj2x0CwpiE+cMQ9XFUjFHm70IKwoBOFGL70Upptxdu 4Tug== 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=itBNzX7+Qi1Y3bHVuJEJdtRTIklJZqEOcvL8dc0SsNc=; b=Iqn43J+rjta2Ph/Wl7bez10M9dxYGJwn/2qoyRUr269MYDSUhrzprffdUDLqmmNyfV h2kBO6SzynburShqz+Nj780ItdQfy/OrJTtZ+Q52LjjAUTsNoKBDJL649KPVB/SqNj3o B/1c2ajPiqDeet1/HiH5LJCdi4U4FLeK0fyfAfJApyOI/4L4aDbzQsePBL+tYlYGaAt4 eG5GaHFojzfc6Y+8/tYTR3mtWhCQK4tdQ47dLaJWrzsXekUF8Gh5vpiqNYjSYMPG8h1s sEKRlKqhwC+ZD406h03/lM6SVCWDmscszSHzGPvGd93Rf187LedTkIme7IPhvKQXgL6z FBKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="CTO/MXcp"; 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 r10-20020a63ce4a000000b003fdc5a65a32si11921394pgi.406.2022.06.13.15.02.38; Mon, 13 Jun 2022 15:02:52 -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="CTO/MXcp"; 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 S1351367AbiFMU4w (ORCPT + 99 others); Mon, 13 Jun 2022 16:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352086AbiFMUyK (ORCPT ); Mon, 13 Jun 2022 16:54:10 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C89F421E14 for ; Mon, 13 Jun 2022 13:19:47 -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=1655151586; 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=itBNzX7+Qi1Y3bHVuJEJdtRTIklJZqEOcvL8dc0SsNc=; b=CTO/MXcpYKOePq407VNan80LeLXILV+ErfumGcOaDZOfgkAedUJm/G11UYFbOkw+52G2RK /Gbp33dkm8G6vYCvHqJFwPeXkH2oP2KafObfzMr0HupFt7ugZmEtX34KdpblFzmxqJCqHT 4doyDmIylaAHsOMDsMVFB4wdgdwnSoI= 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 29/32] kasan: rework function arguments in report.c Date: Mon, 13 Jun 2022 22:14:20 +0200 Message-Id: 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,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. 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 a6b36eb4c33b..a2789d4a05dd 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -207,8 +207,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; @@ -236,33 +236,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) @@ -290,7 +289,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