From patchwork Wed Mar 3 12:11:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12113341 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.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 35A93C433E0 for ; Wed, 3 Mar 2021 12:12:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0AC664E41 for ; Wed, 3 Mar 2021 12:12:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0AC664E41 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0EE748D015B; Wed, 3 Mar 2021 07:12:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0789A8D0157; Wed, 3 Mar 2021 07:12:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0C258D015B; Wed, 3 Mar 2021 07:12:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id C1C3C8D0157 for ; Wed, 3 Mar 2021 07:12:03 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 83A656D89 for ; Wed, 3 Mar 2021 12:12:03 +0000 (UTC) X-FDA: 77878449726.09.7B83112 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf12.hostedemail.com (Postfix) with ESMTP id EF47C12E for ; Wed, 3 Mar 2021 12:12:01 +0000 (UTC) Received: by mail-ed1-f74.google.com with SMTP id o24so1842100edt.15 for ; Wed, 03 Mar 2021 04:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=iJEzlqcbA6uhEUEuHAVXPzScMobXeq18I/DGTA3EYs8=; b=eOYSOVRO77ER5mH0QhxZy1dQq+R5pwjis8BOGfoVKSez5r50LxdDkhYhAhgVPpspbs I0ssKV8fL5rODJqFcSvFCgqc6IBf27llaEs6EMAhMGyD9NNYqgaZR6fH6sqcQIOKEfDR IxD7CluLnvJvY54Wo3N1uoJMBpmk0Em+wWgn1ojtJTqWtJqan9kQsJmfA2PPOiwi/JMd 66FFhBw6ns9XbIPxEwCNTKrfnDO1Z0RcBBEbrMOODXOd4/zU/vyqGeofNrVg3KlwnAOR FYkr2Oqkg3xrK3xLTFYQqQj6/nRhcxf4LSGsb11LrdV2wNUFC31IkOKdJMLQiGnDidsa j+cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=iJEzlqcbA6uhEUEuHAVXPzScMobXeq18I/DGTA3EYs8=; b=ZKiIQXhSlXmbnvem9i421EtPGsXMcPFVqmCQiv1Nk46J/VWKgBt8++xDNDYOAzr6Zt CABKEom8B0pT4tmR8ppxAGnQblKIRHtw5oL7aIgC79dfpYefgb2IvnG36Ssj2pGwRRug OkBpRGj+OJCBjEmEgH+vhp3h+ZalaJQD2eqbjSjq5UXbAtmIFjGAZ2t6A0DQWT1drTuU pe0y8Um7/eQXyp8pyrGTZ4sHh6XjZTK/xA7Cv0RO36VauDdru1JQaphsQiRmqOJjue2G TiwvG5TLO/Hkmi2/i4yAAGSvqYEB9LZOvV/7Dt+0RA4zKrgBcCw86iTcmjRuQKN8a3gR ezwA== X-Gm-Message-State: AOAM530X1v9rriJheKr1ZhaehF+dqm+/nwvtpNCNhA8u5Fugv9VFc4D+ KRI/LGkJjHVEyMezG0L/25TX5ZUmIw== X-Google-Smtp-Source: ABdhPJxdSZ0KR/e1q3osAVGWwuRTz4JELyIhl89vHZCZBb1dsLg/cDn6Mwc3eDQFLWOyOqlaBeVt/sPIbw== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:811:228c:e84:3381]) (user=elver job=sendgmr) by 2002:aa7:cd8d:: with SMTP id x13mr24619685edv.286.1614773521450; Wed, 03 Mar 2021 04:12:01 -0800 (PST) Date: Wed, 3 Mar 2021 13:11:57 +0100 Message-Id: <20210303121157.3430807-1-elver@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH mm] kfence: fix printk format for ptrdiff_t From: Marco Elver To: elver@google.com, akpm@linux-foundation.org Cc: glider@google.com, dvyukov@google.com, andreyknvl@google.com, jannh@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, Christophe Leroy X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EF47C12E X-Stat-Signature: 4qx739d1z76sg3gs9isagwzg8h6hyphi Received-SPF: none (flex--elver.bounces.google.com>: No applicable sender policy available) receiver=imf12; identity=mailfrom; envelope-from="<3EX0_YAUKCBIw3Dw9y66y3w.u64305CF-442Dsu2.69y@flex--elver.bounces.google.com>"; helo=mail-ed1-f74.google.com; client-ip=209.85.208.74 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614773521-617155 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: Use %td for ptrdiff_t. Link: https://lkml.kernel.org/r/3abbe4c9-16ad-c168-a90f-087978ccd8f7@csgroup.eu Reported-by: Christophe Leroy Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko --- mm/kfence/report.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/kfence/report.c b/mm/kfence/report.c index ab83d5a59bb1..519f037720f5 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -116,12 +116,12 @@ void kfence_print_object(struct seq_file *seq, const struct kfence_metadata *met lockdep_assert_held(&meta->lock); if (meta->state == KFENCE_OBJECT_UNUSED) { - seq_con_printf(seq, "kfence-#%zd unused\n", meta - kfence_metadata); + seq_con_printf(seq, "kfence-#%td unused\n", meta - kfence_metadata); return; } seq_con_printf(seq, - "kfence-#%zd [0x%p-0x%p" + "kfence-#%td [0x%p-0x%p" ", size=%d, cache=%s] allocated by task %d:\n", meta - kfence_metadata, (void *)start, (void *)(start + size - 1), size, (cache && cache->name) ? cache->name : "", meta->alloc_track.pid); @@ -204,7 +204,7 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r pr_err("BUG: KFENCE: out-of-bounds %s in %pS\n\n", get_access_type(is_write), (void *)stack_entries[skipnr]); - pr_err("Out-of-bounds %s at 0x%p (%luB %s of kfence-#%zd):\n", + pr_err("Out-of-bounds %s at 0x%p (%luB %s of kfence-#%td):\n", get_access_type(is_write), (void *)address, left_of_object ? meta->addr - address : address - meta->addr, left_of_object ? "left" : "right", object_index); @@ -213,14 +213,14 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r case KFENCE_ERROR_UAF: pr_err("BUG: KFENCE: use-after-free %s in %pS\n\n", get_access_type(is_write), (void *)stack_entries[skipnr]); - pr_err("Use-after-free %s at 0x%p (in kfence-#%zd):\n", + pr_err("Use-after-free %s at 0x%p (in kfence-#%td):\n", get_access_type(is_write), (void *)address, object_index); break; case KFENCE_ERROR_CORRUPTION: pr_err("BUG: KFENCE: memory corruption in %pS\n\n", (void *)stack_entries[skipnr]); pr_err("Corrupted memory at 0x%p ", (void *)address); print_diff_canary(address, 16, meta); - pr_cont(" (in kfence-#%zd):\n", object_index); + pr_cont(" (in kfence-#%td):\n", object_index); break; case KFENCE_ERROR_INVALID: pr_err("BUG: KFENCE: invalid %s in %pS\n\n", get_access_type(is_write), @@ -230,7 +230,7 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r break; case KFENCE_ERROR_INVALID_FREE: pr_err("BUG: KFENCE: invalid free in %pS\n\n", (void *)stack_entries[skipnr]); - pr_err("Invalid free of 0x%p (in kfence-#%zd):\n", (void *)address, + pr_err("Invalid free of 0x%p (in kfence-#%td):\n", (void *)address, object_index); break; }