Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4352702pxb; Tue, 10 Nov 2020 14:22:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5sP5DZGbAUmpD2YR7+mfBq506FnG3DmMbXVDRh4dKVlthdTdwcU1NRH2qFdqiNxviA/WD X-Received: by 2002:a17:906:4dd4:: with SMTP id f20mr21832611ejw.94.1605046962534; Tue, 10 Nov 2020 14:22:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605046962; cv=none; d=google.com; s=arc-20160816; b=gnjjvCg+mIPTM9g/u3v/e7F41asHjQ9i7bIKhlU2BME+yWCPpa2voS1rxQDrDIeYPi bdfTI8qqYHVJGkh6tnvUzpPOiseBdrKTkPy6AC1hdnAgEcCo8O6xAspca+vvxge42aEI j0yPsUEP7CDI0OJhJAIuzQer0WybZi9zV/guylyoF0KmjGWi2mzaWE79U9rbImoGoMpx W6iAFuKbMTcSmoDyvCI8XID3ZFYQQAB9i6VF33ZfN97B0wRqrrNdFKApTxQOMUfiglJr k4bJSZ1Oa6XKmV1YrGJAPMvhshoFDEvKQ6ruZrGMzZhLw8wzqRseTav0gr0562v/zGns ci5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=gNopVjIT8PLD1roCXuMREiwLLvujReoC9+pcOjj05mE=; b=D84xa2zew/5z5ZGws9MM6LmmpUsHxFGBcLPLZ3X8iCkIHQW9VPTANODZeW4MHA3bk5 D4ydXN0WFtseutNSB/SddOpypCF7v4xQlo9FGGsxXGqU3nGjfSfx3yZP6oD6fSG1Qy/Z wz2vw6BXl5PchLrj/CbAUjUJZg332i0GSljLlCSi+AFCpnDfIhnYhYJVEJnhEy55MYGW WymXuhW8Tv7WdDTPcvbP0MzaJrBbccpvpU2wUf49VP7pEJ2BlPHjFbkrDDX4tIJpPT9Y poZJY4TPhLR6htFNxBqjkkhVmNXi5FHHKeUtLHoLclFyOfxhY554ECkZrH2cvP8mTx5X 4Dlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lCftT4m0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si64737edf.226.2020.11.10.14.22.17; Tue, 10 Nov 2020 14:22:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lCftT4m0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732206AbgKJWUm (ORCPT + 99 others); Tue, 10 Nov 2020 17:20:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732087AbgKJWUi (ORCPT ); Tue, 10 Nov 2020 17:20:38 -0500 Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D2DDC0613D1 for ; Tue, 10 Nov 2020 14:20:37 -0800 (PST) Received: by mail-wr1-x449.google.com with SMTP id r16so6159342wrw.22 for ; Tue, 10 Nov 2020 14:20:37 -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=gNopVjIT8PLD1roCXuMREiwLLvujReoC9+pcOjj05mE=; b=lCftT4m06a6889qXGQTef3H4ubHV8kKj9dGlz5f67eoPKWdz/PHnNnYEjABMQLk8d9 KObCel4cnvyGAfTLT3glV7CaPrDc0oVmARZammV+1pVoZ/2jSlMDKbk5t8ghqy2BrnAQ 6wiA3BXXhqVlgixBVMEYRnob8fIiyC/M+a6xp4u0aNMUCSSJaunS7d4ecvp+s9fgBTTl ILcUALwdqyXB6pkQZeuRw2BZ9ehON8RQWBZCFPbVG5/Tjjcf9C/MjxhSUXZvdV4Wx2sm tXxLD2ziia9ZukMCBDzC8zBSj5kuUeYjuML+1LS3YfaqORZ/tW8RY/g6NyBPCfrCuo0E RgsA== 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=gNopVjIT8PLD1roCXuMREiwLLvujReoC9+pcOjj05mE=; b=LKc3j2I8i5rYmCxotRLTRATaE5TjJZOvgEU+OByLKal27e3msMCRZFUn8KbikArAcu CIlSRyfB4fZdtLeUEsnpvs9V7I1p52IMNtE31pxZj4UooWxXR5AbZn2nxC8hLfM67YHT oIyiebZ8FnkC1KbCKHck44dOiGxoa8uYecH2m/ILXUuBjRaFw8+ttoG29dmaBTFfPW7L WYmn8VZ4xPdjS1BNimkE89TSLSXnpDLg/O/cEt/iIVwRIHyDKyYTokGOIkpwV5W0S4t8 +7/YJK4mcyr63NsJ8upNqvvgz2s0saDu7L48k++tI0o5ANa6coteh+oJ7NgQxBWlhwj6 jV5w== X-Gm-Message-State: AOAM530Iv5fWnbLU6zmkYxTX6dm54mNfUmaUP9ihG46XhdDpjwg/jMS6 QJ5dpSN8/42LTGMnP+n/CdpJG+KtBeAB8cVm Sender: "andreyknvl via sendgmr" X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a1c:3803:: with SMTP id f3mr304885wma.14.1605046836014; Tue, 10 Nov 2020 14:20:36 -0800 (PST) Date: Tue, 10 Nov 2020 23:20:07 +0100 In-Reply-To: Message-Id: <5302e6d48429465259bd0868a7dc357290a2e8a5.1605046662.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v2 03/20] kasan: introduce set_alloc_info From: Andrey Konovalov To: Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Catalin Marinas , Will Deacon , Vincenzo Frascino , Evgenii Stepanov , Andrey Ryabinin , Branislav Rankov , Kevin Brodsky , Andrew Morton , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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 8fd04415d8f4..a880e5a547ed 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -318,6 +318,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) { @@ -345,7 +350,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); } -- 2.29.2.222.g5d2a92d10f8-goog