From patchwork Fri Nov 13 22:19:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11905079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 177DCC4742C for ; Fri, 13 Nov 2020 22:41:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C078F2225E for ; Fri, 13 Nov 2020 22:41:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bSH++hrJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="F7pTXHrB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C078F2225E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BGFCL1uZGO8E0/PymEheCTS3eYwDBVCOIEduLGPkaa4=; b=bSH++hrJBsmVGZty/TGWQVFwp S+3Pi0aTGkZMlszvLt2bz9Jk6ZoeC16hrS5OghErW3iLJYoipI+6B4LWgINM3oaY8c3X3htUTe5Dw is7Cw4jVnjDjWIQZSzwJfcyK+2ESEcruOp49k3sk+5GLqRkm8i7sYJCq2T/ZE5T4SdoU/xPXmFNDy dLFyxfKTKnMOluBgkAqXFEN6zxZGq1jRyG0Bcm3n6sTvTBz7NqsYnoqQoKjxaqg68DSUk9nF8TfVu cmpYNl3wwQh6W/WdnAdFxNO1uaBMY8mx9hq75hvqH/1UtEEGT0xggeR0pYs9G9fTvw5jVHcXQaMrE sKkBXaCZw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhjw-0002A9-Jw; Fri, 13 Nov 2020 22:40:20 +0000 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhQx-0001aJ-0c for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 22:20:49 +0000 Received: by mail-qv1-xf49.google.com with SMTP id d41so6968185qvc.23 for ; Fri, 13 Nov 2020 14:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=DB+H7HqoS0BsRTXGNuAwKRf0LlfChpk6LpCcjRkDvbU=; b=F7pTXHrBRZyanjUreyw5h4KDyLv+NRf731NUD0LblbQHl85fHVhh2SMtDJdjbhJ9l1 V1a34qWAYst3ZvrnchN55jYNpbeKhVPN9nhWrO7QdljcZl/3+SnQrsTqVpQMZAEC/Ypl xY2vfRSeYdsyYSzD6VNprwV9REKHfVTvTd3/wEG3VBwT+e4mXCdawCl0lC/PR96ce9wE IOey4TzXaA0dCARaAJ0JINK44loqjAWJje7Uhc+dz8SCJxp53GVxit3+LRu/rRUZlAlD N9o3aBrKwkxkpj2OUzLEBtTHi8snIk9nPlbNFRaIy/mrBGYqTvTe8u4cUOu0cB7UJgdL 2iPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DB+H7HqoS0BsRTXGNuAwKRf0LlfChpk6LpCcjRkDvbU=; b=svq4bquKbnwVi2xuvpQs6ACcY7VxVsXgT41KCyfpfQ/11fxLyD2JzipylCQTICeQ+j RM/5CuJsAFKX/QoLg92J6rCGkdPo5T4nKF+vhjNsQl4FTsjJWJAgnt7npGu4pfhuCgPN t6+KTbjdfQMrZgmPNOunGpUtjSRu26wxuRyRIU2YlcsD3qnkIbNHuoyWXH13s7FtjJS5 66Fsrdvmf8cRrwAYZWMBlGuFKEjKLfuW6feDG8PZY9d6IjUY2pLupn0zuev2sWhVuFKH SefN4Mp+9ErFJQawAt1PalD+HUTB8GZmQQ+3Q53fl377bdCzaT43dQThI7A2YhYKqof7 lu6g== X-Gm-Message-State: AOAM530FUS2s/WnFQV9flcgFh3fh4A8QGpIGbU4cUKP8rLZubKqcvlDk LRpsY1Myhj9NkTsEWYMpZgI9F2PZOzZcvefp X-Google-Smtp-Source: ABdhPJzcA8hQOxnSs80NVqCkReYj+UcQZlyg4LV+//1yN70ab39PQ0at237VgPxvdUPLib1Hm1Mg2FxPUtFHEpt5 X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a05:6214:12ed:: with SMTP id w13mr4550130qvv.23.1605306036643; Fri, 13 Nov 2020 14:20:36 -0800 (PST) Date: Fri, 13 Nov 2020 23:19:59 +0100 In-Reply-To: Message-Id: <4d64025c647190a8b7101d0b1da3deb922535a0d.1605305978.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH mm v3 09/19] kasan: open-code kasan_unpoison_slab From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_172043_129742_1B1F8934 X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Marco Elver , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There's the external annotation kasan_unpoison_slab() that is currently defined as static inline and uses kasan_unpoison_range(). Open-code this function in mempool.c. Otherwise with an upcoming change this function will result in an unnecessary function call. Signed-off-by: Andrey Konovalov Link: https://linux-review.googlesource.com/id/Ia7c8b659f79209935cbaab3913bf7f082cc43a0e Reviewed-by: Marco Elver --- include/linux/kasan.h | 6 ------ mm/mempool.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index 1594177f86bb..872bf145ddde 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -106,11 +106,6 @@ struct kasan_cache { int free_meta_offset; }; -size_t __ksize(const void *); -static inline void kasan_unpoison_slab(const void *ptr) -{ - kasan_unpoison_range(ptr, __ksize(ptr)); -} size_t kasan_metadata_size(struct kmem_cache *cache); bool kasan_save_enable_multi_shot(void); @@ -166,7 +161,6 @@ static inline bool kasan_slab_free(struct kmem_cache *s, void *object, return false; } -static inline void kasan_unpoison_slab(const void *ptr) { } static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; } #endif /* CONFIG_KASAN */ diff --git a/mm/mempool.c b/mm/mempool.c index f473cdddaff0..583a9865b181 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -112,7 +112,7 @@ static __always_inline void kasan_poison_element(mempool_t *pool, void *element) static void kasan_unpoison_element(mempool_t *pool, void *element) { if (pool->alloc == mempool_alloc_slab || pool->alloc == mempool_kmalloc) - kasan_unpoison_slab(element); + kasan_unpoison_range(element, __ksize(element)); else if (pool->alloc == mempool_alloc_pages) kasan_alloc_pages(element, (unsigned long)pool->pool_data); }