Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DC10C636D3 for ; Thu, 9 Feb 2023 22:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjBIWVW (ORCPT ); Thu, 9 Feb 2023 17:21:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjBIWVU (ORCPT ); Thu, 9 Feb 2023 17:21:20 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7EE828D11 for ; Thu, 9 Feb 2023 14:21:19 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id ay1so2316071pfb.7 for ; Thu, 09 Feb 2023 14:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1675981279; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=INi0TWgkRSLsbjVpaGDFPzQPHb0f2T5aCT1XYe2Z1mU=; b=l4GZzGUs4iwqALdBT1nng7ENnjNApXxSAe7gFo1wDjZK3CcEQQcytBT9RjV2hS487J iLPWhCoHgGEwQ8Wje5CuUSKm0tRu/xLa6b1uAA0iiFeu6IK23bgbd+r/OuUKS2LAIqYa SNGXZOSY7oOVcbMnKbQp/w5Wyj/HNjknqAvH4NSZTIHKI9hPIolVLsQd1fo6uv+q5WXx kswiqJbS5b7DMaMuCjSNEXpimzFuTqAnupW5XqyXM8wTzLddX4s9GCxl4URWvw3NJeg0 UmWimymTrp0fISsOyI8YqeWTJRnGT7a4gYp93ChcRjGnyCPsNeMe+jUBmUr/H7LtcBWO EZXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1675981279; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=INi0TWgkRSLsbjVpaGDFPzQPHb0f2T5aCT1XYe2Z1mU=; b=f3oNiiFIliRVa4n6/QiqEna+7TjLYo/OWXDM3a9nty2jEVqQtfRbLkRfSRrolFGoEe +o3G4glPURHV+Wu2Oix5MYJYFZwnUvREV5GC5TouAgr6oF+npEp41OBJaaJD3Rtisv0v VGeZ6KE3DUCHGXj5smvcJoKc0foYMWZ3oMpg4xGbMbgq4BmtkntA2+pQJgCMX4xotxqc cGCJ31zALyZCGrjic/NUUCbtlnVKJUXIyhQoBd2uv24sfZ4MYe1cznD2wqdBhESo3mZD X4C6TAWz6SFj34NqXKA6uPKeZP0g7BzvNE1BQ//bYjXWu2F+ug5FARY+ckWGKVPkj+qE 6rgw== X-Gm-Message-State: AO0yUKWbfdn3H7wa7e9c6l6N1yZ0c8uq06KaDtDwds5hBJr9kD7MAlYu eXX6NqB7J9ofgGPgMWbMcis7HvZQCVnAHJLls5U= X-Google-Smtp-Source: AK7set9Zb2XVF3aLUAZ2wGf+htOd4S/StdXwXwM0398AxxTqrXUBKz8Os/qa2ZXd2z6eHputQ1wQdGbcxaIXQ36SsBY= X-Received: by 2002:a62:79cf:0:b0:593:b73e:49af with SMTP id u198-20020a6279cf000000b00593b73e49afmr2777705pfc.24.1675981279155; Thu, 09 Feb 2023 14:21:19 -0800 (PST) MIME-Version: 1.0 References: <20230201071312.2224452-1-arnd@kernel.org> In-Reply-To: <20230201071312.2224452-1-arnd@kernel.org> From: Andrey Konovalov Date: Thu, 9 Feb 2023 23:21:08 +0100 Message-ID: Subject: Re: [PATCH] kasan: use %zd format for printing size_t To: Arnd Bergmann Cc: Andrey Ryabinin , Andrew Morton , Kuan-Ying Lee , Arnd Bergmann , Alexander Potapenko , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 1, 2023 at 8:13 AM Arnd Bergmann wrote: > > From: Arnd Bergmann > > The size_t type depends on the architecture, so %lu does not work > on most 32-bit ones: > > In file included from include/kunit/assert.h:13, > from include/kunit/test.h:12, > from mm/kasan/report.c:12: > mm/kasan/report.c: In function 'describe_object_addr': > include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] > mm/kasan/report.c:270:9: note: in expansion of macro 'pr_err' > 270 | pr_err("The buggy address is located %d bytes %s of\n" > | ^~~~~~ > > Fixes: 0e301731f558 ("kasan: infer allocation size by scanning metadata") > Signed-off-by: Arnd Bergmann > --- > mm/kasan/report.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/kasan/report.c b/mm/kasan/report.c > index e0492124e90a..89078f912827 100644 > --- a/mm/kasan/report.c > +++ b/mm/kasan/report.c > @@ -268,7 +268,7 @@ static void describe_object_addr(const void *addr, struct kasan_report_info *inf > } > > pr_err("The buggy address is located %d bytes %s of\n" > - " %s%lu-byte region [%px, %px)\n", > + " %s%zu-byte region [%px, %px)\n", > rel_bytes, rel_type, region_state, info->alloc_size, > (void *)object_addr, (void *)(object_addr + info->alloc_size)); > } > -- > 2.39.0 > Reviewed-by: Andrey Konovalov Thanks!