Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2605427rdb; Wed, 21 Feb 2024 13:05:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGnK+H8lkt4zlJq2ZT7dk3YNyqbz3nf3uknPBwH6Xso5DFVg5nOWsEQ/3Y+Q7Lfsi0yD6tSFDNuhKd9rksT5eoNQ32ODqGaMMFsmpGZQ== X-Google-Smtp-Source: AGHT+IH9rLmjyqcEhDRov3NOfQGhjxkYeaLsL/cuEE6+QZLh/PMQZJ9rYSSG8mBczBSFs4n+qokr X-Received: by 2002:aa7:cf11:0:b0:565:21a8:1e35 with SMTP id a17-20020aa7cf11000000b0056521a81e35mr619293edy.3.1708549553496; Wed, 21 Feb 2024 13:05:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708549553; cv=pass; d=google.com; s=arc-20160816; b=JbAxRfyDmhJqf3EIVUSE9dSX58wPnWSF/cNdJ4PG+7kfop1yOoVnyjuk67qkrxaFPJ Yfp4L/MZYTtIFj7hL7bjpq7QFSYl/7umFhjyMJRxPcEnkQTCIuTkC0zFruj8KVTD9pUj kLlrhH8FRg+/hxdimMxi9mjMsbuEtyMCq35wZhNZ3fc/7HYdffx/NdeW0lwWDYqX1eq+ udEhbwuwSGf2jgA1b44bx2yXiuyjc8pkA6iX0JGE05MElhXzGDPx1y0YZ4rIyLIGRS+e IgQ8J/H3doKCquAe+vQnvGvQJRnP73SHk8nfkjNgeMC4v5FDVokgBaSaVy5Yw3F+/GOR Wxgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ejwz9DMghoUipFK/izgowqt2tzkszOXlq4euAJSl++o=; fh=k2UJXskmY3ZHV1YWSkd16QvRv5xT8RZD1FZZ5n04KM8=; b=wPDNmEGN4QFX1RfOPtZUnJkhPxwWAhpb2Z8oO6kj3EgXyUWVWqTME6UMx/3WhtTJQe +Bgka4VAsrKV1q17QokWCGIfRHnaUl7uM6ubx4BceihIyrNvgS8fHPCwSD3Gc57FUJ8H Qh+8yHaOE1Np8T6atRmAf7IL3cc6uySMlYKxVm5ekTjxn5JekK01F2PS/hYHtgkMGv2i hyZ1xkV139huYWYZrXjbzSdV5QUDb4F98DQq32Ymt+hz3yqsMjgS0zF9lFJhfyvdlej1 Glfh4Vu7IDLbqBiJMNAQndrr00+ku7Al/TlHf3nOGNw0VRmgxR0FcXUxnktSFRpZDkuA 3UkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nUP0bRhc; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75491-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75491-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c32-20020a509fa3000000b00564e013165fsi1401501edf.616.2024.02.21.13.05.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:05:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75491-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nUP0bRhc; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75491-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75491-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3AE911F23122 for ; Wed, 21 Feb 2024 21:05:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0DD3126F25; Wed, 21 Feb 2024 21:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nUP0bRhc" Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B83EC3A1DB for ; Wed, 21 Feb 2024 21:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708549542; cv=none; b=NxlvLD+NTiBmh3Opi0LX4t1ShRcI7SIBqRW4GiCfitw7uKnrdzE/uQ9MREaXUpueIvH+vpu8DlSxBDBQ90QGwJ23SnJ6uvJasio173Vs0r3ogPPh5NvJdSuIgFfYStwvld0kppqwUoNFjcDOZROcZTEuc40GTimgmgguvmrmu0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708549542; c=relaxed/simple; bh=efRf7+25RPEbSTdwUFWDXboYWSyI9tgjpHFvClKXfH4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iPZbLlQj0tMo9BlCwM55JPtPK35kWqM1oRzHu1gISM06InJZ0fFY0cOR7VLoZ/rJlBo1eKvWOU/9G6Ohtyla3CPWRyuJFy5aE/W5KtJfw7lcDUwpGMeCK1tDEQkNwgwffTkvRtVS7gSRF0iIvYfzONgUpzHFa0BEcQLJAQFKDZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nUP0bRhc; arc=none smtp.client-ip=209.85.166.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7bf7e37dc60so391261239f.3 for ; Wed, 21 Feb 2024 13:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708549538; x=1709154338; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ejwz9DMghoUipFK/izgowqt2tzkszOXlq4euAJSl++o=; b=nUP0bRhcHSYDnuHmxxOSxQo8Ctnm2gp9nwsBQdSxky1PUUdmgjhEgHIEmtE/2qr4ah 8tRk7FOMMyQEXEWojc1P6LKrnG/rIO2DyRsnjaCPPt07ilKhVidEqEx75icvndZx9u6y iTN8xP2r/rc9OFv/ppuPSkHjGTy4/tWT5/mfJ3WPkb4gLrJA1WQZaitkvfDENSNnYP2b +vzZc6+ZB1rulcM6/zv9P2qmHdeg9sEIKe4OVkIJ64FEWocxuN8WO8LB7fzz9yDErshM KFi04YThlN8YcVT72hHpUHgtiMyBVF83NO7CDFyC9P1QEEPPHtl/HTJGuQ9SMXxWxXkM AfOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708549538; x=1709154338; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ejwz9DMghoUipFK/izgowqt2tzkszOXlq4euAJSl++o=; b=i9Xh/vgTqmGdCZZ5ZBDu+ejUpCQQi6smoV3cafeHz2wpf+0IQAo7ElYnfqYAa9Optw kZO7ukRHuFrzyb9DsBpmv6Z7fuKtsZ0yHkKP8rdDO0LhiZQD8JGKVoMTLO7XWmA64q5E Ja90ldReP7brGGbpqeaJSgBnPdyB2rjCiQhlSg0Rv5I+7ubUwFThSwAK+N0UwQ59iaVJ 1Cmx9urSvlJ8V8/CB5oUNbBA6vLszDre1z99CKiAwXRYZngnnZazucR6LwHdJ7ah73Q/ WIXeR8jB0mc1nTe2uogcrNnQ5sM8HXXhBDMLaVy/l8qKefMjGMvqMXyHPL+j56JSGGCb gUrA== X-Forwarded-Encrypted: i=1; AJvYcCXpfi4AZ43CB9es9k8ju7ATzJ0AO8bMm8LA9/e0+7bW5GKtZH50zFcDmFCgOxlGc98fuxLgwTE1jure1Z64Hs/fmE2TAkCChUAGPaVQ X-Gm-Message-State: AOJu0YynGxbJ5anJ+QezG6IZUdaq6OQAdDLHRMpGFJWE7+a2wa71xFQS IjJXtuaNpWrGLdgEi72DZms8kft56YAMEI3jHsEuuEejCTfmCA4B1pIhj2VYAQ== X-Received: by 2002:a5d:9f41:0:b0:7c4:3ffa:25e9 with SMTP id u1-20020a5d9f41000000b007c43ffa25e9mr20859695iot.1.1708549537828; Wed, 21 Feb 2024 13:05:37 -0800 (PST) Received: from google.com (161.74.123.34.bc.googleusercontent.com. [34.123.74.161]) by smtp.gmail.com with ESMTPSA id q1-20020a6bf201000000b007c744e62df3sm2177661ioh.34.2024.02.21.13.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:05:36 -0800 (PST) Date: Wed, 21 Feb 2024 21:05:34 +0000 From: Justin Stitt To: David Gow Cc: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , Christian =?utf-8?B?S8O2bmln?= , Kees Cook , =?utf-8?B?TWHDrXJh?= Canal , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo , Brendan Higgins , Daniel Latypov , Stephen Boyd , David Airlie , Maxime Ripard , "David S . Miller" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, linux-rtc@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-hardening@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 3/9] lib: memcpy_kunit: Fix an invalid format specifier in an assertion msg Message-ID: <20240221210534.eeodh3qxopgp3dhy@google.com> References: <20240221092728.1281499-1-davidgow@google.com> <20240221092728.1281499-4-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240221092728.1281499-4-davidgow@google.com> Hi, On Wed, Feb 21, 2024 at 05:27:16PM +0800, David Gow wrote: > The 'i' passed as an assertion message is a size_t, so should use '%zu', > not '%d'. > > This was found by annotating the _MSG() variants of KUnit's assertions > to let gcc validate the format strings. > > Fixes: bb95ebbe89a7 ("lib: Introduce CONFIG_MEMCPY_KUNIT_TEST") > Signed-off-by: David Gow > --- Reviewed-by: Justin Stitt > lib/memcpy_kunit.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/memcpy_kunit.c b/lib/memcpy_kunit.c > index 440aee705ccc..30e00ef0bf2e 100644 > --- a/lib/memcpy_kunit.c > +++ b/lib/memcpy_kunit.c > @@ -32,7 +32,7 @@ struct some_bytes { > BUILD_BUG_ON(sizeof(instance.data) != 32); \ > for (size_t i = 0; i < sizeof(instance.data); i++) { \ > KUNIT_ASSERT_EQ_MSG(test, instance.data[i], v, \ > - "line %d: '%s' not initialized to 0x%02x @ %d (saw 0x%02x)\n", \ > + "line %d: '%s' not initialized to 0x%02x @ %zu (saw 0x%02x)\n", \ > __LINE__, #instance, v, i, instance.data[i]); \ > } \ > } while (0) > @@ -41,7 +41,7 @@ struct some_bytes { > BUILD_BUG_ON(sizeof(one) != sizeof(two)); \ > for (size_t i = 0; i < sizeof(one); i++) { \ > KUNIT_EXPECT_EQ_MSG(test, one.data[i], two.data[i], \ > - "line %d: %s.data[%d] (0x%02x) != %s.data[%d] (0x%02x)\n", \ > + "line %d: %s.data[%zu] (0x%02x) != %s.data[%zu] (0x%02x)\n", \ > __LINE__, #one, i, one.data[i], #two, i, two.data[i]); \ > } \ > kunit_info(test, "ok: " TEST_OP "() " name "\n"); \ > -- > 2.44.0.rc0.258.g7320e95886-goog > Thanks Justin