From patchwork Wed Mar 2 16:36:34 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: 12766304 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 71935C4332F for ; Wed, 2 Mar 2022 16:39:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8ED08D0006; Wed, 2 Mar 2022 11:39:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3D248D0001; Wed, 2 Mar 2022 11:39:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB7568D0006; Wed, 2 Mar 2022 11:39:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id AC5168D0001 for ; Wed, 2 Mar 2022 11:39:03 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7F3A1222D9 for ; Wed, 2 Mar 2022 16:39:03 +0000 (UTC) X-FDA: 79200005766.05.11AF40E Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf21.hostedemail.com (Postfix) with ESMTP id 3D7D11C001C for ; Wed, 2 Mar 2022 16:39:01 +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=1646239138; 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=M062mhOVYVf9bJIp01ZOeX3qpFJNVUV/wAEZA8I272E=; b=lH9wtAh7UDSWF/e9AczfTV9enN4uq/JJvUnkvS3JD5lO39CTU8KgFlOa8XuaMRO5OBz/Rk +Gte5syiG2TrYhFZ5NuL2BGI/f9VgTmWVR+r0hvmFWvNp9TqUusWNQXJrSNdKo9w9VVizH pDmUp3Zb0WD+KB7MoptfkaUEEtwc450= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 14/22] kasan: merge __kasan_report into kasan_report Date: Wed, 2 Mar 2022 17:36:34 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3D7D11C001C X-Stat-Signature: y1it9gj19uhwxwupa3acxp8qtogcxphm Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=lH9wtAh7; spf=pass (imf21.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspam-User: X-HE-Tag: 1646239141-180596 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 Merge __kasan_report() into kasan_report(). The code is simple enough to be readable without the __kasan_report() helper. Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 41c7966451e3..56d5ba235542 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -435,37 +435,31 @@ static void print_report(struct kasan_access_info *info) } } -static void __kasan_report(void *addr, size_t size, bool is_write, - unsigned long ip) -{ - struct kasan_access_info info; - unsigned long flags; - - start_report(&flags, true); - - info.access_addr = addr; - info.first_bad_addr = kasan_find_first_bad_addr(addr, size); - info.access_size = size; - info.is_write = is_write; - info.ip = ip; - - print_report(&info); - - end_report(&flags, addr); -} - bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) { - unsigned long ua_flags = user_access_save(); bool ret = true; + void *ptr = (void *)addr; + unsigned long ua_flags = user_access_save(); + unsigned long irq_flags; + struct kasan_access_info info; if (unlikely(!report_enabled())) { ret = false; goto out; } - __kasan_report((void *)addr, size, is_write, ip); + start_report(&irq_flags, true); + + info.access_addr = ptr; + info.first_bad_addr = kasan_find_first_bad_addr(ptr, size); + info.access_size = size; + info.is_write = is_write; + info.ip = ip; + + print_report(&info); + + end_report(&irq_flags, ptr); out: user_access_restore(ua_flags);