From patchwork Mon Nov 23 20:14:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11926659 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,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 E0AB3C388F9 for ; Mon, 23 Nov 2020 20:31:51 +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 64BF320715 for ; Mon, 23 Nov 2020 20:31:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iN9gHgaH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="X8wfvSUP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64BF320715 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=TKwPaMpEq4JoWcMB4pNa+HrLapdrIHx4v2Eo/zQA3LM=; b=iN9gHgaH+F0bltBkXiee7e0aC p8ETdnW7zQbuM6Vqh4tzRe/kXkrddHAkfTuO8fb0mN0J+a/Hl3o0lQwzP4Cbip8V15rjaNA6QrBUs eyHUR9mk0vg/Kg3xKFZPt09HnuppNybixEwcyzmMw2pYqZlWAJi7k1EQjTYTxKDiyT9u9FFag15mV yjxjrZjcHyyd+nXKgBL0FDp4HsHQCRJlIHSl9QsohRFjYJYZPHSNmxMXraIyIqnyeuF+wvv/JWTt9 mcrL4bEaBX7rC0SJ4/wD6ucaB3tSjUhxPhnQY56PwUeSE0V4mX/x78SY6NGiAmOyuZrw9xciPmxe2 gS4C+aiyw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIUT-0000vG-1C; Mon, 23 Nov 2020 20:31:13 +0000 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIEt-00029P-6Q for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 20:15:12 +0000 Received: by mail-qt1-x84a.google.com with SMTP id i39so14498639qtb.1 for ; Mon, 23 Nov 2020 12:15:03 -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=X0qNbr9WproLcGX2R7jejC4I91Gg1JCilClxf4uOdQ4=; b=X8wfvSUPWDOeubA5laS0MiS+5zHTHlfDCeXD7x++Y29NOmeLLnfbzlFHR4Hb5I2RLu 9wd7W4DbL8t9WKn3i3FFJCexrLUKyqTUwXXHQ430kj8PdXDFnUpSI4xrd3GsfIU/ptme K5x/3lGScHV8LUNjww9qOHEJXgtGUueWlDXazSz1ByCXleTVf1o8CzId6vU/sQOvsLIK qdHzXbL8ZjXUmWsfu1sm/1iqAf842e3xeAL6FiYUl8MBbvK82iAc5qTIJtyBLOIjQMpZ rODbG8A5iOgyQ40ayjPhbqHoBebQeju5HciYk8AeFACmdvRUt57vrv0DQ7E+Gd4Gj2ZU TM7Q== 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=X0qNbr9WproLcGX2R7jejC4I91Gg1JCilClxf4uOdQ4=; b=IzIEUex/B0C8Mo9qDsaNUUL34c/s3FXmqSQGNZIpgGk9pBq3h4P1AC5QMhiIbT/Tsa mkA1h9kcEhQ647bY0UCQh3DVxpXyvO2PUxOsB9MYUdzrA7tQR76Apwx6yiUpsJDBqntI YBRY+z8YSKeZOwyj9lwziB0bLMuJdg3dA3NBFaS7mEC+1lGaVBEZDeGW+AeCT+F++ikv sihY/giHozGHBbPuXMdZXizRo1ZOGSrfSqNwLU5SCURto2jGW1qP5OW20/OzFVy1olpG EEjvstaXM/siR+xuvXwFKHiJ91Q73Ds0eyQ7dzKJJpW7otoqu3sOzq7Hzs4c74aTbxgw pPQg== X-Gm-Message-State: AOAM5323bw4IxpJxJ+US1/RUzLdo1/MAYflP8FEfz6VqvKai8//btpFO hfjM4CNoDxXXtT8jIceFNaZaWN9Vr0I898Dy X-Google-Smtp-Source: ABdhPJzImvXjbgZa+dqZyuNCYbUOjmgmMgki62vl+7qg8STo88r/i4TsRQg7xr1TST9CH00poNibD1gCn0B4pbPv X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a05:6214:9a9:: with SMTP id du9mr1102774qvb.47.1606162500502; Mon, 23 Nov 2020 12:15:00 -0800 (PST) Date: Mon, 23 Nov 2020 21:14:33 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH mm v4 03/19] kasan: introduce set_alloc_info From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_151507_882879_83F77A5E X-CRM114-Status: GOOD ( 12.74 ) 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 Add set_alloc_info() helper and move kasan_set_track() into it. This will simplify the code for one of the upcoming changes. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Reviewed-by: Marco Elver Link: https://linux-review.googlesource.com/id/I0316193cbb4ecc9b87b7c2eee0dd79f8ec908c1a --- mm/kasan/common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 8197399b0a1f..0a420f1dbc54 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -327,6 +327,11 @@ bool kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip) return __kasan_slab_free(cache, object, ip, true); } +static void set_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags) +{ + kasan_set_track(&kasan_get_alloc_meta(cache, object)->alloc_track, flags); +} + static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, size_t size, gfp_t flags, bool keep_tag) { @@ -357,7 +362,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, KASAN_KMALLOC_REDZONE); if (cache->flags & SLAB_KASAN) - kasan_set_track(&kasan_get_alloc_meta(cache, object)->alloc_track, flags); + set_alloc_info(cache, (void *)object, flags); return set_tag(object, tag); }