Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2358498rdb; Wed, 21 Feb 2024 05:28:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUiIBVUg/N7rE9ATROFfiSgYjViR8YkhCKMb8xBvUZ4gjUNcWdxUCrCBkCL2W/6QV2v61HyCSU5GpwgoQfjyAjWSykloGjH+3OOkhkHEw== X-Google-Smtp-Source: AGHT+IH3O+WBsU4Xxs5gI+CP4zhxnjCD4X/9U8DVQrlqaTu6f8JPtPCdVbY8LaQo8iJbGo8STH6t X-Received: by 2002:a25:8a07:0:b0:dca:e4fd:b6d6 with SMTP id g7-20020a258a07000000b00dcae4fdb6d6mr14347638ybl.61.1708522085342; Wed, 21 Feb 2024 05:28:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708522085; cv=pass; d=google.com; s=arc-20160816; b=HXK2LxGAIz5iaLdoh2wqPeTFnlJmQupx4kkp4Db+WL4JeZj24B80kWriNTxkmXj93Z XWjO6LdE1lunQkMXm9G2lMgade8fhZpgGGAKDAXk7wiOw5EVyHxDrLOsyobb91xSpAl9 IUKQ3fKaH+o8X1rTVsF0eAf7YtWnfzfFr2+rmOc5Z1V9aBlCjt7d0I/dKDi7G1b5sx1y sDMcLJWQ0IDjklX/TbjxD5tJeD0lwGmVI9IDdiKZcF7jTb0mCc/vOzZda21oRk/wMCBo lysIgIS4dgWqDNQLOFNYigGDCYJFmrhxCkM3sGeiAUasLo2c1JsjnW4IURPZl9SRqdHA HuJw== 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:sender:dkim-signature; bh=TMD7R8y65kHdSRzvHZ0/j8HTA7EF077bxXH3c7GeV1c=; fh=QPGdPTtq4jfvQRzYY4dpGYiEs0ScU/AX8e+Gau9AQWc=; b=MUx7SwyqTZpo0kLAU9/846j/PLzSscZ6TZlM1qSZlhQ8MlzwBmftKEdfAAX+/u0XJD ilfav08PGT9kmwUOwaPZKjrN4zO4ZiFfm427uDN3M5Ch46u6QEnFmRy9fbwgfQcx9uHo YCj8q0GwiUxQqv/6sVEWgU2Hh2hdQUoysIrD7NA9jKDiw5jPtvE2fvYUqY7/ay67Y1+N zQBr8IExH7/Tt4itA6y5v6FCeV2+vwVTxGev13XDBztsFox1j/46yz9e8cv6d4GDBGl4 yQj9lRIa6BWUtBo7HaOzh8IXzYfUmwwTjMldyLvJskmA6hIxRWRZhOXzVbEX+Kfr0TGU yOew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lv4sN0MX; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74791-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74791-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x26-20020a05620a099a00b00785be8e5f85si10822892qkx.247.2024.02.21.05.28.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:28:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74791-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lv4sN0MX; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74791-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74791-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D0CB1C23124 for ; Wed, 21 Feb 2024 13:28:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5FCC7F47C; Wed, 21 Feb 2024 13:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lv4sN0MX" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 8DAB076905; Wed, 21 Feb 2024 13:25:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521951; cv=none; b=f6M0rIco4Tfs7Qwk7UMYmF+e+gnWLkHMkE3QX9qHqZaryeE9pARCuzeE+7Kwo5/2x5uaPB3ACxTF/lxuJ4KGqMIqWyD4KuLWZZNNbOtphHyLRCwSYXUfb/JkiQ+gS4BW2NKz6KsCK98TaByKWKmg43GqZljye92DHJGXzarKBks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521951; c=relaxed/simple; bh=Nm1KU7/+mO88+1MStPxwNA0OsfOBVrbQL2XjjeYXgrU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eHoiBsNKxEBBQddkHOm19v+ABAxhImcQY3XVO4Kjv2gw6WwzBJoFRuxvMzxe+hu22Rva+PSY5W9MrjzaMbk3SVWn4BzfGob+hPaszYxmPR6T0yDZB2GsH3brMqY3nWIy531bMP1bdyFHhI6F6Kw4FiOd3HFiNMFGPKUyGa4wGnU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lv4sN0MX; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d7232dcb3eso39217505ad.2; Wed, 21 Feb 2024 05:25:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708521949; x=1709126749; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=TMD7R8y65kHdSRzvHZ0/j8HTA7EF077bxXH3c7GeV1c=; b=lv4sN0MXJWrNu1V4gto7mUvAXXtNnHoxVMcNWbwHRIGXU0A5KYSkYUYNnuJdwgHwhB 8LjrDBPHMi9YRY29Lj2ONAug47C9uHN/DcgS3JAnLB+3TpWt20+DvJKwnqo3wgmGCSf2 jJjwZGIBqvA2AyZK/Qf8GjWWfmTbUro6iwNZVwXdEGleLOJXC8Uzq7q+8pJLXi/rxOIt qjPvqgnsXoTuLX9ob5X6gEDeuqu0YflSJYloYr7X4B5g9GivcK+Ccd5yMjdE/N613tq3 AgnmrBw583oewPLfNDE3WI623t3GeXNi49b3pORD8JY4MW3x5XKtZHAxSRlLQphPGAlk a8dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708521949; x=1709126749; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TMD7R8y65kHdSRzvHZ0/j8HTA7EF077bxXH3c7GeV1c=; b=Cxu4N+GrhNwVAdyE8/BS19GrNWRqdE2gZCQTU2DhrIrx8kPZbLiNZiyRHTa4zZSBO7 ffcUiZ1A03hMV5mdL8L1WUqQPOvmR4du0icrxCNX11SSZZMaeGBw0n8qnWQ4xM/TCt5D NYa2kZC6Vi9PNQGH3boHIN36dB8ZyUBzE6mxcCZx8Vv8l6eYwqEmMGD2eQMK5mBX2rd+ 0psNsniKldz0FKHLF9RlLwGzkCsGv+ZN0kkQLI7QW7AXPJXH/TMNqaP8at3xwMCeot8L sDXOdFPuMb5NCBKkyBkgWNcFPWZ/LuLeR3hQh7tu7BqDVBPPxACr/c1LC8gTcZE14YtE xPAQ== X-Forwarded-Encrypted: i=1; AJvYcCUppyuXK5dRLT03XN1kfsiK0s54dGz6ikH5qrNv/BLv2i4HOBZ3FCuBxFr2Wy/kg6rnrhkOgO5wfe0yz3JXDIAx6VnrMk5i73WxZB+LcUKgnJBCz2I+kZM9ilTOyF9EtTej2zJY8E6B67nLCXi+1wOYUFbCuF9jR7SuSkYqByHaZmZ0crV8ZBJqiBg0iJfIV5AJkV33PH+fANaoV8CcdXwkceBQSpVLc6OwWr2LsXxRwhe9+AxP+AtS8TI/zbXA+md1 X-Gm-Message-State: AOJu0YwVhExaDTDz9UsuAouj/DkGeuJrtFENUNxktl3iE4j1vo3ppHAj XlVlX5Odn2LAcz6cDXxOxWv45vBYOQxx8Ae6e4FeBa08hbao/1L2 X-Received: by 2002:a17:902:d489:b0:1dc:1e7c:cd3 with SMTP id c9-20020a170902d48900b001dc1e7c0cd3mr4511989plg.47.1708521948937; Wed, 21 Feb 2024 05:25:48 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id p16-20020a170902ebd000b001da2f9d04b0sm8077527plg.15.2024.02.21.05.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:25:48 -0800 (PST) Sender: Guenter Roeck Date: Wed, 21 Feb 2024 05:25:47 -0800 From: Guenter Roeck To: David Gow Cc: Linus Torvalds , Shuah Khan , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , Christian =?iso-8859-1?Q?K=F6nig?= , Kees Cook , =?iso-8859-1?Q?Ma=EDra?= 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: 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> 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 Tested-by: Guenter Roeck > --- > 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 >