Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2555383lqp; Mon, 25 Mar 2024 02:26:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8QpVQqjNBTi5EoV2C5I2CKOmHpE2/zxx2F2j4T66yvDREewVTzAoNjXM4sEcbipMRmlaZ27hFh6JiaKnoIVZznr3Bw7cR/EKrfX5jxA== X-Google-Smtp-Source: AGHT+IF2VXpikppQhKQ0hyvjcEVYnEYeA57YJ0sqssc6mKAeYVVJsmjrqmx3pUvur/GwPPB3Uvkh X-Received: by 2002:a17:902:ecd1:b0:1dd:7c2e:a31c with SMTP id a17-20020a170902ecd100b001dd7c2ea31cmr6401606plh.50.1711358774484; Mon, 25 Mar 2024 02:26:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711358774; cv=pass; d=google.com; s=arc-20160816; b=vr5R9o/jBE1DhUxO0us4MZ2rUryPnm3QHPnuhmjsmGF7IZ7dWkY5ZSaekIIpYfrga7 kbwTJqy0x3kaUluHDZQ+lxQC2RL2uYPDJGmkhFZUB+Tnx90gIJRDya1/6G1QFj6Fr47L J9ThbYsm1cN8GYDr2NPkoouwgdy7lip7b+KVJIa/4ezjoPq3CZz5s/ymG+YMlozO9zQV QQCLp5woXlcmrruVrpW/X8dCTZ4UcGFLO6AXxKTgLrIUwkTCYkTW24BreHR3iaxvJDBH Nk+lVxDe5uiuQbS9yCuo4EuxrwMlTdNbnAMqUm0wTdFv0+jPid1liAfxolvyi3Sxa0Mi jqeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cetvzPrIYZtc5Y2JceXaqOcxY5aRUcrDVi+bNRhzgoQ=; fh=8RLesEX/izE45skaFMbpAL6XzjHMQxils0u7MR51RLA=; b=gBr02RDyrgHSkZKTUu/9JtOqh9RX0/DnUu61ipUOvCG5yYhH+775ef5hWElaGh4vRr WfWgi6x+q8GMmqo5UPF3bC64c6aTNRHEWnu/FoBNTRLt+sxjDyDEw+mXkuqPBzHMM+Kc 8OHFcPEnTOI/U8zaWGbBTa2avE9Wql5uMEXP2GXh7a59zFrKkk385KWj+v/s7U3ERg2x ov1u1V8gCCakdZ3Rx0XfIkCoO4w/IJGlqUAKLz+YQlKMEq35bdk9LcmVbKSnj6C/BsxH V7Hn/p+tubOVBCNyiYXEwwrYa1+vZMsWQ5NRkAZav9p58zoMntB9ky2rQNuc6Bf4kNMP rcNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=deb9pJ1b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t2-20020a17090340c200b001e04f4c88ffsi3722196pld.83.2024.03.25.02.26.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:26:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=deb9pJ1b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4D93329BB09 for ; Mon, 25 Mar 2024 09:26:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5756374729; Mon, 25 Mar 2024 03:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="deb9pJ1b" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4DF4145B06; Sun, 24 Mar 2024 23:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321998; cv=none; b=LovQtAl38V0xC9FzJ68ENpeVCqU+WZmAL9JkVKTDbnTrj6f+P7Kb2mufvTW5IzHJItsnOs/pLS4xzPbco+Yc7bzCeQR/mz5mtNeb5coK9hpkt43B8TZWvPO2vdMlwcjaNhSkeLHQ/LwaB24mDoKq8Ex42KkYx6SgFP5InUAlGP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321998; c=relaxed/simple; bh=aRaLv0aWTnLotsxN5UN9UBm7Px06ZsdF21YYz4MEXPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RRcRscCIAnD5DTylEAn+0eeo07a0ACy43XFCJfEBlUj1/OL2cTLIXXLmxYuqclmu144JL82tIZk11wXsa4FAPb+hR30rVcEwEjNYwDdzkCCOPVVni/K8wuADG7Z2byti1FtSuvGPU39KMtBkLxjfMQ/QfJbRa4knQlchfjbCjgE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=deb9pJ1b; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E46C9C433F1; Sun, 24 Mar 2024 23:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321997; bh=aRaLv0aWTnLotsxN5UN9UBm7Px06ZsdF21YYz4MEXPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=deb9pJ1bxjwbAuVo3MJgaXIo3V45jKv0H+PHPrd4l+v0FwW1rEgP+6flG9hJmD1kq yfuXTOxy8ES7FtdSJ3bOUpUx71k3OLRdPWh1/Se4uG3XZOruRRiqYycRv02xDBQAuo huvLTKnkWWZqR2ReXgLum7tMWiaMYSYHZlsElzueFq05RFQL5zpPtns+pz0T73h+3x km/r0VS7dESDN8RdR/DPnp/mHvQ4moEsUmEQPFdM8gbaMQsXDez5Ibhln971RlfDVU /NQJM3G4d79C6KANIlSVdvltlejZ81x/561h7YOkpk163QsoUmSF2WwIyAPNvU3Pg4 E+Do4LSOA/fQg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Gow , Guenter Roeck , Justin Stitt , Shuah Khan , Sasha Levin Subject: [PATCH 6.1 069/451] lib: memcpy_kunit: Fix an invalid format specifier in an assertion msg Date: Sun, 24 Mar 2024 19:05:45 -0400 Message-ID: <20240324231207.1351418-70-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: David Gow [ Upstream commit 0a549ed22c3c7cc6da5c5f5918efd019944489a5 ] 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 Reviewed-by: Justin Stitt Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- 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 2b5cc70ac53fc..dbedd99aa6163 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.43.0