From patchwork Fri Mar 25 01:12:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12791186 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 60D61C433F5 for ; Fri, 25 Mar 2022 01:12:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E874A8D002C; Thu, 24 Mar 2022 21:12:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0E548D0005; Thu, 24 Mar 2022 21:12:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFDC48D002C; Thu, 24 Mar 2022 21:12:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id C1B3E8D0005 for ; Thu, 24 Mar 2022 21:12:55 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8C0AE1828D834 for ; Fri, 25 Mar 2022 01:12:55 +0000 (UTC) X-FDA: 79281134310.20.60F76DF Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf16.hostedemail.com (Postfix) with ESMTP id 178F5180029 for ; Fri, 25 Mar 2022 01:12:54 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02F01B82708; Fri, 25 Mar 2022 01:12:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8EC5C340ED; Fri, 25 Mar 2022 01:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648170772; bh=qiwxu019qFYoxeCaO4BXlQi/rPgeDjWTWAoExj2JVOQ=; h=Date:To:From:In-Reply-To:Subject:From; b=JVMH7c6kIZY36BbAkMv0HrL9HRWhrWdMH/SpIL7e7PMrg4m9kmuIG+3rT81z2WnRZ nhhJD+uH9O85XrB9r8UOoJdm2toWfh5Ug7M3C8C6kA14QKRsxahgeqJnssAf0192F3 H7beQ2niFs+xJcaHYvSRq91l8v6Q1E8V3xypFSZ4= Date: Thu, 24 Mar 2022 18:12:52 -0700 To: ryabinin.a.a@gmail.com,glider@google.com,elver@google.com,dvyukov@google.com,andreyknvl@google.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220324180758.96b1ac7e17675d6bc474485e@linux-foundation.org> Subject: [patch 086/114] kasan: merge __kasan_report into kasan_report Message-Id: <20220325011252.A8EC5C340ED@smtp.kernel.org> X-Stat-Signature: 9cwkguzjjztbcb1zh7mgm5h5y7rrjbhp X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 178F5180029 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=JVMH7c6k; dmarc=none; spf=pass (imf16.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1648170774-200533 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 Subject: kasan: merge __kasan_report into kasan_report Merge __kasan_report() into kasan_report(). The code is simple enough to be readable without the __kasan_report() helper. Link: https://lkml.kernel.org/r/c8a125497ef82f7042b3795918dffb81a85a878e.1646237226.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Marco Elver Signed-off-by: Andrew Morton --- mm/kasan/report.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) --- a/mm/kasan/report.c~kasan-merge-__kasan_report-into-kasan_report +++ a/mm/kasan/report.c @@ -435,37 +435,31 @@ static void print_report(struct kasan_ac } } -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);