From patchwork Tue Nov 10 22:20:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895711 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=unavailable 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 87D9DC55ABD for ; Tue, 10 Nov 2020 22:33:01 +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 095162068D for ; Tue, 10 Nov 2020 22:33:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="j3EIvcMR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="B6QwfVBA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 095162068D 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=GH96qVxwimkPf5RWVMX2M6oRGjq2ciq4zVxN8TLjPZY=; b=j3EIvcMRSwQcAKnQmRRQ26Kda 9/z8qOCmb0UJDgTAX2KLLutWltWlrbwB4FW4jnNwVKq0xPFcY4WYNN5LdmWe/4itKqZQZrRLWLhnd 9d4pyjrgUyp+UOs/oLkAiMPR0uY1D/squOmMox168ITP83h/rjfRLRIqMAhDuEqsSh24zmhfR75AK XTYuFOurRGz+oQsqLWpprzwUvpOJCLBMV/dLLufZWR7GgHHXZrIyRLTeQWh5UsBV8oxd560tgY64A iKYE26QqH5lxicAi+dCqXa8f7HdjpqYGHy7fMWg94Q7sDqLilJEGgUjExoNi7ggZvEDUnyV7Lztnx LNqUpIKWg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccAD-0004s2-S3; Tue, 10 Nov 2020 22:30:58 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcc0C-0000BZ-3r for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:20:46 +0000 Received: by mail-wm1-x349.google.com with SMTP id u207so1866177wmu.4 for ; Tue, 10 Nov 2020 14:20:32 -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=SMV12gvgXWyti1wWozncOBF2sC/NzCwG5tM1W9vYuH4=; b=B6QwfVBAz7pkQ6yN3GQqARn2ii4rZdYmih8xg6h0+kbT6exEYUg4pd4Iohk94eyM1c mfyXHR7Pxl38SAXC+UEdfwWOGQNZDQyHqw0WxKX+1aldC5Nh33y9y1wUbwjCW1D0yajz 82APgf+BpR2WC3RpKvYiDkV8kFzJxpoXE7CFk42ZB+MpjTlBxJm0XvKG7IxF4CW0/YAU G5dkj7NUrzW4l90Z8ZrgBn308BRtQCP8KJTgZyqtc9ySrVSwXbVeMNlFKR3/b04gGUiT bClkE+hnLWgDfQGY229UlKDA4DC0pu/Iq0yDc0SmjQZcRbEmjzC5MnBcn/JR/TO1dWNI M5UA== 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=SMV12gvgXWyti1wWozncOBF2sC/NzCwG5tM1W9vYuH4=; b=cYOkY1jbgdp90RuxX1fZMMp4T1nHFiF65oLGLyaUGen9xJiSqzTEOGJSk53BvsToRx 8phrYmHrIkroP1N6r2h0bwCqhSchHfYzxPCO5mE4KoVQU0w5r7d1UdWJgS+v03S+hSxU gw0bpLAo7H+Phm7ljjHnSfDKYoGHR7tHiyAttOGe7qMMg9Tmv3G0UJilTPZnZ8M1A5sd 36LiC8r2xmyEEPKYKFJ2dKwuXL3tqUvGUrFjAG8RELOr5kawctBAfSNZa3vKId6oHtwp gUNd/MovbPgnh8vIbBGlDZpDQfF41QUXyrgPULSVqCc9qxVeN/JtGSvGhlst+obqCYwf 2m5g== X-Gm-Message-State: AOAM531a9SuENeNc91iRz9avOq+QEFPjHEiLm0vjvKYDRXoa4GmsCGyq abs2sJTyGkRwn30MoT+xZ73gHiA50NJMcCIf X-Google-Smtp-Source: ABdhPJxOgxlfhZQUpHjQ0Geh6GQq8dMdva8blwAYkX9VCtBB6RV5i3/j12u3n9DxhI2tM3WRQFA2yXCA2IHyyaf/ X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a1c:5f45:: with SMTP id t66mr315013wmb.20.1605046831528; Tue, 10 Nov 2020 14:20:31 -0800 (PST) Date: Tue, 10 Nov 2020 23:20:05 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v2 01/20] kasan: simplify quarantine_put call site From: Andrey Konovalov To: Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_172036_230522_451D2C1A X-CRM114-Status: GOOD ( 14.35 ) 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: Branislav Rankov , Catalin Marinas , Kevin Brodsky , Will Deacon , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Andrey Konovalov , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move get_free_info() call into quarantine_put() to simplify the call site. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f Reviewed-by: Marco Elver --- mm/kasan/common.c | 2 +- mm/kasan/kasan.h | 5 ++--- mm/kasan/quarantine.c | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 2bb0ef6da6bd..5712c66c11c1 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -308,7 +308,7 @@ static bool __kasan_slab_free(struct kmem_cache *cache, void *object, kasan_set_free_info(cache, object, tag); - quarantine_put(get_free_info(cache, object), cache); + quarantine_put(cache, object); return IS_ENABLED(CONFIG_KASAN_GENERIC); } diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 21fe75c66f26..c2c40ec1544d 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -214,12 +214,11 @@ struct kasan_track *kasan_get_free_track(struct kmem_cache *cache, #if defined(CONFIG_KASAN_GENERIC) && \ (defined(CONFIG_SLAB) || defined(CONFIG_SLUB)) -void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache); +void quarantine_put(struct kmem_cache *cache, void *object); void quarantine_reduce(void); void quarantine_remove_cache(struct kmem_cache *cache); #else -static inline void quarantine_put(struct kasan_free_meta *info, - struct kmem_cache *cache) { } +static inline void quarantine_put(struct kmem_cache *cache, void *object) { } static inline void quarantine_reduce(void) { } static inline void quarantine_remove_cache(struct kmem_cache *cache) { } #endif diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c index 580ff5610fc1..a0792f0d6d0f 100644 --- a/mm/kasan/quarantine.c +++ b/mm/kasan/quarantine.c @@ -161,11 +161,12 @@ static void qlist_free_all(struct qlist_head *q, struct kmem_cache *cache) qlist_init(q); } -void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache) +void quarantine_put(struct kmem_cache *cache, void *object) { unsigned long flags; struct qlist_head *q; struct qlist_head temp = QLIST_INIT; + struct kasan_free_meta *info = get_free_info(cache, object); /* * Note: irq must be disabled until after we move the batch to the