From patchwork Wed Feb 1 07:13:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13123865 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66BEEC38142 for ; Wed, 1 Feb 2023 07:13:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EE966B0071; Wed, 1 Feb 2023 02:13:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7998A6B0075; Wed, 1 Feb 2023 02:13:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 689426B0078; Wed, 1 Feb 2023 02:13:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 52B086B0071 for ; Wed, 1 Feb 2023 02:13:22 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2CA35403D7 for ; Wed, 1 Feb 2023 07:13:22 +0000 (UTC) X-FDA: 80417857044.13.65909B5 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf21.hostedemail.com (Postfix) with ESMTP id 814E41C0002 for ; Wed, 1 Feb 2023 07:13:19 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Mz3312IU; spf=pass (imf21.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675235599; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=4BmlzaxYuvz6yK8Z6bcg8GUmZ6rvSFskLQ6yKMJuJi8=; b=z52LZwpWB1XOSjBECx/sEmF/BHMJpTejHbo5PdjpzfD8kj8ikhBE+cuhBkfHnrTzDWC9Js QRz+AoXAzK3MwoQXlYOf8kCJlLh3XEEqHbCRggkhm0cUH5rrLmDh+QQcSBWMojx0LldtnV iGNPslqoy+ft0vFjRaver70z+vCIE6A= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Mz3312IU; spf=pass (imf21.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675235599; a=rsa-sha256; cv=none; b=Mzi0g9DJwuWC7S8M1PiEdhPLPdbl8nEKuHgCLTftt0PG5PBfpOx+nBqKEnyAGVrU/oizgf FdlO7hJz1XbSTDQW1J8a3IAYk1BDzc92U8H8X4nkYqwfwUJ2U25n83tV4zH0d4b2RLpPWp pqitnYjtijhPORU1lSJkgZBarsA+ZvE= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0485DB81FF5; Wed, 1 Feb 2023 07:13:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22D8AC433A7; Wed, 1 Feb 2023 07:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675235596; bh=UPrLvL4ctKw2Zf8x33aGj+iLuYJwq7287ZPxq8Zg168=; h=From:To:Cc:Subject:Date:From; b=Mz3312IUQ5/0tcPHhFquBbNjEDv/3z4S5zZO3oQz4G39WhdyHktBotvzo5lQtiaNS obp/n6yQ3QCQW+IjyxrC5ukCBpxgpnn3cAU36QQA6DzjXcj68m3JpBFOP1ztVLrhpO 6DUFzKA7pXJi7c+qx2ezUaHCEybW5jtkxdrRHYVBWlOvPrb/1KHJ8j1M+inlIcA5rM NHBhTEUi7D+mLe1Q43Qrq+wBYPItJfNFXqjhT/F44MTx6axLHoGV1hec4pDjao4eUV AHPDcebmiulhVFwOayux8GwWpiaYpoVxjkaQmjeGrkBqIsGY0Dc4/3QN/0+g6a1IcH NZa6Mm7gBCCyQ== From: Arnd Bergmann To: Andrey Ryabinin , Andrew Morton , Kuan-Ying Lee Cc: Arnd Bergmann , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] kasan: use %zd format for printing size_t Date: Wed, 1 Feb 2023 08:13:04 +0100 Message-Id: <20230201071312.2224452-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Stat-Signature: 338qrtu6ahmsud6miyobf8urma7bmgkm X-Rspam-User: X-Rspamd-Queue-Id: 814E41C0002 X-Rspamd-Server: rspam06 X-HE-Tag: 1675235599-246526 X-HE-Meta: U2FsdGVkX1+OonGd7CpFpSp6ZkBHVnHAH2etCGgzc8F5sxm2RDVynKNpX6d9ar1Q4Sf+IArO5ADN7aLlh48IT478TMnd2VkVlzFGQtfUG0f6SKRr7ZqiLtUWdbRsbgZAhVtoBMT3HYK9ypbD5u6VigiymuN49YW5tIu44iLXf18wIk10lVxxeJb/5FHeXC+N2smBq+9PxeSXFKOKZ5yTXrDL8w0fsG11j9IhOATSO6y0uy8b/Nv/fGqJHm6uH6fqV8bGO2dmzS8wAvSYehiVocLnu62fXW6zbDGih2r7u1Fu59VTE3+o3I7qtyyXsZ9iWb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oeow3biC12giGCMLBbxHpiV 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: 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 Reviewed-by: Randy Dunlap Tested-by: Randy Dunlap Reviewed-by: Andrey Konovalov --- 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)); }