From patchwork Wed Feb 21 09:27:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565166 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2A0BC48BC3 for ; Wed, 21 Feb 2024 09:28:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CEEFE10E4E9; Wed, 21 Feb 2024 09:28:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="OHSicdGk"; dkim-atps=neutral Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D7B910E4F7 for ; Wed, 21 Feb 2024 09:28:06 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dced704f17cso2525042276.1 for ; Wed, 21 Feb 2024 01:28:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507685; x=1709112485; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Xu+inTe2LF3ynuuv7W7Ho6VSuZooh3VEfNa1s4AiQic=; b=OHSicdGkKTrzTDALuKFHYlRlkX9U3oyfBg1cjgEVIkBB9HNoND9vJN9B8PpppM58v4 1iEXgnGXhVwtm09G4PawVF0qao4A1iqjz4ihN5+teZMTfj5QWf6WBDyXv9txzEe08t0P pNrCBoUiO4PBX4J+ETTDzqQZTchHfGQNW9/vKP1xPB1So0T1K4HcbHZXBLaFHggA6fQT /3G1xxkylo6A6c1jO6NORdhhnNqgNd1Y2ofvZhqb4Q2aTfxsqaXd4TAnl2K0Oj7RSyzu Xb8TnT0u502vypRMYWwJLx1yBrLR1qhRDw8rI+h2zs/9/JSeC6GLHBW1lROSbWuwMQhJ x1ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507685; x=1709112485; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Xu+inTe2LF3ynuuv7W7Ho6VSuZooh3VEfNa1s4AiQic=; b=RZCR+mBoERsxRbCxRiNi1gfzhvhbFWq7ZcRobuomFzX9rbdhMrKg6GhLbmPdJveGiF rOQP1Yiqm1Exa3o7EwCQm4juf34zgch4M6GxyQol6JRkQmqj9Fj3lnR5GGorK57AaaG3 5GahRDYWWOQO8k7dCaZR+PXUhAf0d1opZtY3foOtKvbwGHPyNIQRvFZPvDCankMilSGB CL3JVABhg38I4KjHVOmFuTtBALAws0IKdw3u96yVNSRzXPqqsfnJQV1Dgjn5aPbr5IZi 1aEqXlYzRAaJNNaLyJkDhumk8S8jtyA99I/Bp+eXylFXTs1TJUbJPrCUkWtzKYZhXfoA dEUw== X-Forwarded-Encrypted: i=1; AJvYcCUVzTtHpXAhpwwcCuKFCVVTPxS8fj7g12Wr5IzSUXrtTmyQ/CUpfhcNkqElytdyiXBmrq6mkPwVuDf7UX9KNUkhRN/QmSwNX68E9W/2iXM6 X-Gm-Message-State: AOJu0YyoInHJkWpjFgwxZUSjdz5uVOWaDO8SLhRYjPeuRjx6sH1PQE9x JvFx2CVKrhHaC8TkFZXJ8woqABIxxFEDgFyY9lltUmcyMrDmDTxqe1foAVHYpJ43CD1klneH2R5 XB7U6tdHpJg== X-Google-Smtp-Source: AGHT+IFRWRv9O0ZJFWIQABWXYSjWTv0ZUYrlwMd+3gPavDYER8N+pRX59ZNK2IiQ8Dvkd5y8wLfb4lO8UUdSxw== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6902:1005:b0:dc7:59d9:7b46 with SMTP id w5-20020a056902100500b00dc759d97b46mr624383ybt.3.1708507685189; Wed, 21 Feb 2024 01:28:05 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:14 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-2-davidgow@google.com> Subject: [PATCH 1/9] kunit: test: Log the correct filter string in executor_test From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" KUnit's executor_test logs the filter string in KUNIT_ASSERT_EQ_MSG(), but passed a random character from the filter, rather than the whole string. This was found by annotating KUNIT_ASSERT_EQ_MSG() to let gcc validate the format string. Fixes: 76066f93f1df ("kunit: add tests for filtering attributes") Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Justin Stitt Reviewed-by: Daniel Latypov Reviewed-by: Rae Moar --- lib/kunit/executor_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kunit/executor_test.c b/lib/kunit/executor_test.c index 22d4ee86dbed..3f7f967e3688 100644 --- a/lib/kunit/executor_test.c +++ b/lib/kunit/executor_test.c @@ -129,7 +129,7 @@ static void parse_filter_attr_test(struct kunit *test) GFP_KERNEL); for (j = 0; j < filter_count; j++) { parsed_filters[j] = kunit_next_attr_filter(&filter, &err); - KUNIT_ASSERT_EQ_MSG(test, err, 0, "failed to parse filter '%s'", filters[j]); + KUNIT_ASSERT_EQ_MSG(test, err, 0, "failed to parse filter from '%s'", filters); } KUNIT_EXPECT_STREQ(test, kunit_attr_filter_name(parsed_filters[0]), "speed"); From patchwork Wed Feb 21 09:27:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565167 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 466BBC48BF6 for ; Wed, 21 Feb 2024 09:28:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BDDF10E4F8; Wed, 21 Feb 2024 09:28:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="nOXzTG+y"; dkim-atps=neutral Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by gabe.freedesktop.org (Postfix) with ESMTPS id DFF9E10E4F8 for ; Wed, 21 Feb 2024 09:28:10 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6082ad43ca1so50800377b3.2 for ; Wed, 21 Feb 2024 01:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507690; x=1709112490; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NeQowu5ygMbqfsZc+b92OS1HjirLANcwpz/yagEqKMA=; b=nOXzTG+y/H4sMZ952zd48wxhKvVyu6iky1TCnDEejRdX3vRuoPZVhD0cCYMNwZcaEv gmDHZKf1mVebAbrrdy4f7XL4I0KhEQJoOmownLcQvGPM6R/2i8oI+JzmzR9JdOT6Fdjt EORSkB4QOLSD+teKLIe96K8ffTckGc9s37No+2jirMVWniqHaeOSR5BeCrGSxEQD/lZ9 PCbrH/vPzCgk9PPfeuvd/za+VDfZ+HvdAZ3mMB7GnwAt6Sb+C0A1WurvOfhdRRkVjsvB J320Tx3hBNn+OUvTYA1W4aiOLifDhd6//HQvhkSTSu+Td/X+JjyDFXMoe889ktH1mwEp 2pNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507690; x=1709112490; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NeQowu5ygMbqfsZc+b92OS1HjirLANcwpz/yagEqKMA=; b=C63EuvWpmJRMBoheSKtrlyQbKcZEqGiDqpOBjiG8zMELsFN6fhvil8WkAww7km1Yck Xa0XHR6rCbgZwCZ1LPQ8xvACors+twbRw5rr1zmDCFj3Ed2dUbipfFP93JtyAbPdI8rv VrjQTxDvx9puyi4IQW3rWPqp6A9IwJth5vMxVqDDrpxHw7lbioaZ6D14Thu7lQR3QZq2 yck7rzVZ/A55PAfKBZykHrwocC6Gf94HqeP2BbDNm6z22SXtlxhLYLdIbvHDx7F8uHGV gVkJvqhLXnZUwHQ1dow4FQSH+oipCHh10W981KnHpspoNJOgj1pakwIP1tGJG1nAv/A2 dFpw== X-Forwarded-Encrypted: i=1; AJvYcCX/gwXcWXgym043+0NWf3CGSw+lv08lnsMOKk0T1wLMoZIS3UPyOaqmh+aann1rPu4SIq/OOzDW2f1oSNQR9tgNzeL1wkzL90tJdVkDEXSF X-Gm-Message-State: AOJu0YxK9twgzCg975nnnbciVPJ/erdAykI5zjxfe9JptHjy2xIPq0pb rpzR8Gr3hMdMwjjdA32mdcKVIPKxe1hz6LKWxLrHgUFy9+eV87PKSOx1lQeCOhn8kNjLZobVlpB m1MAMh8qClQ== X-Google-Smtp-Source: AGHT+IGKmHDvlseXRZ4Y+4ut8ocdYLBEplEGH+dd9qwAR6JMHTXNGTF3psUQFQki1OvQHuO3rgwKUwj3z7weqQ== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6902:1001:b0:dcc:79ab:e522 with SMTP id w1-20020a056902100100b00dcc79abe522mr728743ybt.11.1708507689903; Wed, 21 Feb 2024 01:28:09 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:15 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-3-davidgow@google.com> Subject: [PATCH 2/9] lib/cmdline: Fix an invalid format specifier in an assertion msg From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The correct format specifier for p - n (both p and n are pointers) is %td, as the type should be ptrdiff_t. This was discovered by annotating KUnit assertion macros with gcc's printf specifier, but note that gcc incorrectly suggested a %d or %ld specifier (depending on the pointer size of the architecture being built). Fixes: 0ea09083116d ("lib/cmdline: Allow get_options() to take 0 to validate the input") Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Daniel Latypov --- lib/cmdline_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cmdline_kunit.c b/lib/cmdline_kunit.c index d4572dbc9145..705b82736be0 100644 --- a/lib/cmdline_kunit.c +++ b/lib/cmdline_kunit.c @@ -124,7 +124,7 @@ static void cmdline_do_one_range_test(struct kunit *test, const char *in, n, e[0], r[0]); p = memchr_inv(&r[1], 0, sizeof(r) - sizeof(r[0])); - KUNIT_EXPECT_PTR_EQ_MSG(test, p, NULL, "in test %u at %u out of bound", n, p - r); + KUNIT_EXPECT_PTR_EQ_MSG(test, p, NULL, "in test %u at %td out of bound", n, p - r); } static void cmdline_test_range(struct kunit *test) From patchwork Wed Feb 21 09:27:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565168 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61FA8C54764 for ; Wed, 21 Feb 2024 09:28:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC44610E4DA; Wed, 21 Feb 2024 09:28:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="aZNNDVVk"; dkim-atps=neutral Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0183110E674 for ; Wed, 21 Feb 2024 09:28:14 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc746178515so10656710276.2 for ; Wed, 21 Feb 2024 01:28:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507694; x=1709112494; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=sajAUUIIQYuGe8qQNpfUtUdwcf5MUYWJWHx5st8lTqQ=; b=aZNNDVVkooGqF0VIHCgsHDDjf5Miq9XQTfhvP0nclgDDVOTpVDuJNzKizwa5ITqsrZ aGHHrPECgpb70NSyT1aU+qJCCNsidNtElTEYuhQJZ6QR5UquPQOcf1jd5ppOfvsLdZoe RLqA5nYteKPZwkFYOxPD2H4Z56//6it2zClWtg0ib1znP3KWwqK9SWJlnbpTpBOiK8ty t8QniAkSRPRdDTKtgAcyAE2FQP9v413BGopLADWGbgwPJYcq/7rVL2eSvxCGBCaosOfp nbIsLJBY2vtUu7zW7fTLXfe8UBZUscDvZVRIz4vy7AYxsuCry4epFTCn+Hz02EyGXi0a X0tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507694; x=1709112494; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sajAUUIIQYuGe8qQNpfUtUdwcf5MUYWJWHx5st8lTqQ=; b=MqHJ4SinFVdY/OMxbCGyrE7728jXZ0oVOLNXfLPbL9VD5DrlftNPwYNu6ag8ZaV1yq tdRajAzPjZPhhKJ7LAb3o76c6r2hLu8lwPeL5jnQ4p4MkKwJNwbulsfF9RQU606Q8Koz /+i+FHItBRM1tMYWR4RKocexh5A5FBK+bDoU/QI/++zukmX7VFYJ0uBZlCrBdim7Ku01 yKL11eeoEIJ4l8CdrxEOfGBNBLofcWKElT6fGaahIdvraGtrOiUdMVwY+CtvYrSRS0O8 pr+SfOljl3wxa3eegVT8lVORRh9aGwuJd7IOiLND1KRgPlPcHEr6LJ6jAoORS4FBAXXb n4VA== X-Forwarded-Encrypted: i=1; AJvYcCWBwPLi8u1ZaxNW7m8pzM/AQnxP9vnMqyuY40b/qpiLSRK6MF0BfLA6oLiwIZeRlTry40yAoyYEfLRcsz0JRxjOVTbnx06+DA9BogYsjXjg X-Gm-Message-State: AOJu0YztxoKVCIjUClAVQbsWay6W7K/3LCk58Wzx2TUI3nhBVqIGzFOB 7Zh9SavdRsUPtqsUFp0lANkEvEup+eaNBNCnBbS63TGXXye1oUF7goW/utb1tlUEfan8NdchkQf I8VxXxRMLPQ== X-Google-Smtp-Source: AGHT+IHXN4IhYXj6gHEWGA94Amz/iLtPWuo+Xnyc3GcMGDuMyWPS0mpLGyU+Di2N0vYTLFyOCsPHpf7g1H0Bgg== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a25:b192:0:b0:dcd:88e9:e508 with SMTP id h18-20020a25b192000000b00dcd88e9e508mr4406327ybj.5.1708507694045; Wed, 21 Feb 2024 01:28:14 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:16 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-4-davidgow@google.com> Subject: [PATCH 3/9] lib: memcpy_kunit: Fix an invalid format specifier in an assertion msg From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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"); \ From patchwork Wed Feb 21 09:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565169 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B898C48BF6 for ; Wed, 21 Feb 2024 09:28:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63A6A10E674; Wed, 21 Feb 2024 09:28:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="UB906qPN"; dkim-atps=neutral Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by gabe.freedesktop.org (Postfix) with ESMTPS id B81FB10E674 for ; Wed, 21 Feb 2024 09:28:19 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcbee93a3e1so8081183276.3 for ; Wed, 21 Feb 2024 01:28:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507699; x=1709112499; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Z9U7+OVqCU0rhDEd8d2z0lAB4Gret4PnmLwRYwmvgX8=; b=UB906qPNLh2MnJA0IPbLDtC0BD1D4tf2t3U3koPtMXrigrFYhoj6KDn032UXm8L9hA 6+ayGOl7O0JIANaIBH/7jygd/a0vbgHudRHAh74qreNBhrtldPI2DCRItSE/xSmMkXhr KB2D4yUPO52K4P+mx7PJ2lRneVp5sQhYqirTh6ZAiSJAn08ygOAyERgsoAIVVIv0a7MH wL/jgLOXs0NnzE5QUNYFF1R7b3XnnjyamHXXsMM5yl1wjZpYEe99DLl2llX7S4bJV25u JfQcrha3F5SlpgkM3G3WVqIct7mn9Q1FUvMPYFwGUIddJZAVCY5QSjVnnYzLVBNmrnHu QLtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507699; x=1709112499; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z9U7+OVqCU0rhDEd8d2z0lAB4Gret4PnmLwRYwmvgX8=; b=J7sXuAyNW6fsDckB0n4mf9WkYd6eBq9fAYk6bcUdvnpB3ogxOClx4xUpil7KhYDcYR 2KTpre5cvwest5IainpY9kbJC3DrTqeqwlf3+kKF7Kf0zicRqqyJGx8qynjMq31X15Gp 3Wg87qaHiMb+/R3uvGPhCLznFfHRFHraP44gE0susbquUf00T9eVUWJ15SkpZSnHOI7/ Vv1xWODNpisBwA7r7Wl2cnogaDhmrLXsZ/rAmm5HDM54OwSLQNNu7Vx0vmp/5HUTkxUM kGNMStX65Q4mZoln/UPwYpjTtY0fLz5KT2K55nqkYji/s2+VyUyCffjLP53wmkx5vfEr SdBA== X-Forwarded-Encrypted: i=1; AJvYcCUpa1OjQnra0RwFPV4kPneyZDFGVutIDJoRBAmOScwCbHEk8zcF3JizbID+KGhnWa/xM7pGvAoUqbjzZSaoaZzr9q7j6IPmmZO/SPq/oo/e X-Gm-Message-State: AOJu0YxYL14ZB3wKV9XcWx7PwFNCbZ1OGDLqXLZpzNjdwN887xmo5m1+ jXHoIp8VaPKAARRGINLIw5Xp0VXRb7hJNf9/AazVmbpCeVoQmoM5GN9LU1y0TCTCmrYzYAV/0aP C0Rch0iWBqg== X-Google-Smtp-Source: AGHT+IHQmEZgvDehwTVbCeyhhzp67M3ZAq3QtZNAjC+xaNviI3L4AtsF+O/jA3jQTZUOnw086+ZCDp3kuUdK4Q== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a25:69c4:0:b0:dcc:9f24:692b with SMTP id e187-20020a2569c4000000b00dcc9f24692bmr1016456ybc.13.1708507698808; Wed, 21 Feb 2024 01:28:18 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:17 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-5-davidgow@google.com> Subject: [PATCH 4/9] time: test: Fix incorrect format specifier From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 'days' is a s64 (from div_s64), and so should use a %lld specifier. This was found by extending KUnit's assertion macros to use gcc's __printf attribute. Fixes: 276010551664 ("time: Improve performance of time64_to_tm()") Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Justin Stitt --- kernel/time/time_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c index ca058c8af6ba..3e5d422dd15c 100644 --- a/kernel/time/time_test.c +++ b/kernel/time/time_test.c @@ -73,7 +73,7 @@ static void time64_to_tm_test_date_range(struct kunit *test) days = div_s64(secs, 86400); - #define FAIL_MSG "%05ld/%02d/%02d (%2d) : %ld", \ + #define FAIL_MSG "%05ld/%02d/%02d (%2d) : %lld", \ year, month, mdday, yday, days KUNIT_ASSERT_EQ_MSG(test, year - 1900, result.tm_year, FAIL_MSG); From patchwork Wed Feb 21 09:27:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565170 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0482C48BF6 for ; Wed, 21 Feb 2024 09:28:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D70E310E652; Wed, 21 Feb 2024 09:28:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="cPDX3ks7"; dkim-atps=neutral Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7248310E67B for ; Wed, 21 Feb 2024 09:28:24 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6047a047f58so104742807b3.3 for ; Wed, 21 Feb 2024 01:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507703; x=1709112503; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=6oh8w0yc8LvH1yvSHI8zU+2R7q+ewyvFM42Am6pdhYA=; b=cPDX3ks7b/yKJBo8KX35o3UB1RnqeTpaaGv1TlLxQ1pYn4USJ82e8iOSsPWO81Yb3K NqmPRksegPt1HnD7D5ET691TwidH61ecEvm93TNt8He1PGOk/Qf1tXB0CmX9sTX6Gq7Q asYeDkUXC1ypg4+VSjfb222LwmXqkGblXF4N3HI+M/Vrll81pfRcivsyQj+eqDYOqGVH Jo/HGDai/UsbH4lmpi/bqlLSC55q7UpBgjohiDWDbraB1ZghGddS/6WkOkY9+8CV8O5p xK9cMzQdWq+nTU43aO9cyprHGSaDpsZCt5qUdObjzunwGra6KHTYTe6LbQ+8FFwzTGgT q56g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507703; x=1709112503; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6oh8w0yc8LvH1yvSHI8zU+2R7q+ewyvFM42Am6pdhYA=; b=GwzQ1SK+K1akSIdFy2aRM0y6VfftfhDQ/iYGMnsFFoc1ek8AnUjOih88hy/NYBbbal 0Bj5gg4EL7TuP2c6x96jmXh0quKCD9bRn+n9SjgBX5DiDnNFYI6Ogo1QVPqo7ZZZZ/1t Q9rNmfF2T6lY13I0Uh33fFTKLEIxA104cbIdRKnT0rYR58kK55M9fh6QtVEoYWaeATen wcZuq6gvITuc/TAkrSlxOa/7pg/WqeEd4seRUGmy6yeXAWjnPs8kzNbizOnynSIx94fy Iq3zzgF4/eXHqc9oc/at/uKE7LgEAdOj5Qz8kp7kL4YoFRIqp6sryxE7+mcUHEv6mAZq HetA== X-Forwarded-Encrypted: i=1; AJvYcCW1iQUqB2pZUMoiqJjDEohM/Pz57mAs3WvjeCIzJDZ5OJYNAP7ZLuD5/D77mT7JExsOLg4jDELB/J0xZ/kZ+Hejkb3/wg4YCWqDA4v4wdVn X-Gm-Message-State: AOJu0YyYwEODlMmr3KppsdKt5QxvnelMOdJNaXXl2B3s9ogl0P+XmS17 Vn/8kCag1LlTjyR7Dz8ttxmI3fHdIM9bo/+jrmcvWQ/My/7+j1dKa9bf4F7G3Q4YuTLs1sdtQJ7 tB2EEOr7mag== X-Google-Smtp-Source: AGHT+IHAVxan3IBdGfT14ZlxAMIfrkzUxv01ETxOcEryam+Wji8MbAhrWelAxlNmlmHCaTgl78twQW5eAT/4hw== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a0d:e8c4:0:b0:607:cd11:5464 with SMTP id r187-20020a0de8c4000000b00607cd115464mr4264994ywe.9.1708507703514; Wed, 21 Feb 2024 01:28:23 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:18 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-6-davidgow@google.com> Subject: [PATCH 5/9] rtc: test: Fix invalid format specifier. From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 'days' is a s64 (from div_s64), and so should use a %lld specifier. This was found by extending KUnit's assertion macros to use gcc's __printf attribute. Fixes: 1d1bb12a8b18 ("rtc: Improve performance of rtc_time64_to_tm(). Add tests.") Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Justin Stitt Acked-by: Alexandre Belloni --- drivers/rtc/lib_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/lib_test.c b/drivers/rtc/lib_test.c index d5caf36c56cd..225c859d6da5 100644 --- a/drivers/rtc/lib_test.c +++ b/drivers/rtc/lib_test.c @@ -54,7 +54,7 @@ static void rtc_time64_to_tm_test_date_range(struct kunit *test) days = div_s64(secs, 86400); - #define FAIL_MSG "%d/%02d/%02d (%2d) : %ld", \ + #define FAIL_MSG "%d/%02d/%02d (%2d) : %lld", \ year, month, mday, yday, days KUNIT_ASSERT_EQ_MSG(test, year - 1900, result.tm_year, FAIL_MSG); From patchwork Wed Feb 21 09:27:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565171 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8BB03C48BF6 for ; Wed, 21 Feb 2024 09:28:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D6B510E50B; Wed, 21 Feb 2024 09:28:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="OR8PHALc"; dkim-atps=neutral Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA11810E67E for ; Wed, 21 Feb 2024 09:28:28 +0000 (UTC) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607838c0800so82851497b3.1 for ; Wed, 21 Feb 2024 01:28:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507708; x=1709112508; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=l+N/x8q0XM6q/oxl++oFE/zLIduvg/H3kbNqGrSm6L0=; b=OR8PHALcSxYjX18FxooasIFjpGF9KP1DEBNR6CL51ztNvgJJsH2cbekPYu7taco5zI MzUr6oy8yVnzdv+gDFDnUSEwUdaaErm/gIq2s1fmWoAxsRQJjKJ3WUpdZ03CcZTxc7i6 sZLcXlVB0Egw2BynmfvxlB+R0b5BSMe1JjxI/SO5SUwz7PU1n7+a0MxdDYl8mn7XbR9H kkyFhmOIBzhB0lrroKxmKe5gJed6A9IoH+WuwVKQEp+yTuCfbOHXuz69VGXq+MjcYYk3 EsFSeaAL+/ky8GcGWk7hBUFxhUv8TVZn7lz0cLJKnvKBTqOpv+9uRkkW5qRmJ3DHd0Ec HXHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507708; x=1709112508; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l+N/x8q0XM6q/oxl++oFE/zLIduvg/H3kbNqGrSm6L0=; b=Kbf0LzHiey5RUdFK2yWkU/znsTzNsVdx0FPFvCDWnX7DSpGDZpe5tkmP0m6ZLTaat+ TkISakWl8auEraSilzT+wEUWwdmlwI2K2H+GqtmwaHbK02qFS6KypSuk7l7Hrz7H5z84 UYinWdTugCe2phHYLfRyHmlygNlAh9LShIvx06TaIiWnff/VTyb+xaiYgSzuEUOZnjbq pDXS9xHp+uo7TL3tepE8S2jNKv9kyA0c2SXUS6R7+myQu/dzJBtKlg/jEGbnxJ3k6Htu KYLjmjwuopzPEyA4Nr0FjDVLdARtbpgXnReJst5Rsc4btm8k/DP30xOZf1VIqfBORd7h Q5PQ== X-Forwarded-Encrypted: i=1; AJvYcCWi4OjF3X5X9Qd509j+b9WcKHjDamsthf8Gzd6AFj1vttiAu1PUa9z3S09tKVVxc3CcaDWxMGXKq5HOeHaX25Rd+NhQakSICadRFnRV+N+W X-Gm-Message-State: AOJu0Yw5Hw3HRT+og+Vh8ARWlXML1MlwniPOpkzBI6I4qnEFOny/TJK+ 6ykgFKXbBy1o6a4DNuAfrUHdO+pRHzJ0atswq17L3TFsFheR3HGL3FWJMRldoZyEs/XfVzLXvjj 7T4ubzTQeDg== X-Google-Smtp-Source: AGHT+IGujiTgGmrs6aB7MYtXNm4zgRA3Zr4vV9toQOw9f+upbD+oRsb+6ooQYjPHHocWRD49vELQV317edlmfg== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6902:1081:b0:dc2:2e5c:a21d with SMTP id v1-20020a056902108100b00dc22e5ca21dmr5584522ybu.6.1708507707855; Wed, 21 Feb 2024 01:28:27 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:19 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-7-davidgow@google.com> Subject: [PATCH 6/9] net: test: Fix printf format specifier in skb_segment kunit test From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" KUNIT_FAIL() accepts a printf-style format string, but previously did not let gcc validate it with the __printf() attribute. The use of %lld for the result of PTR_ERR() is not correct. Instead, use %pe and pass the actual error pointer. printk() will format it correctly (and give a symbolic name rather than a number if available, which should make the output more readable, too). Fixes: b3098d32ed6e ("net: add skb_segment kunit test") Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Justin Stitt --- net/core/gso_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/gso_test.c b/net/core/gso_test.c index 4c2e77bd12f4..358c44680d91 100644 --- a/net/core/gso_test.c +++ b/net/core/gso_test.c @@ -225,7 +225,7 @@ static void gso_test_func(struct kunit *test) segs = skb_segment(skb, features); if (IS_ERR(segs)) { - KUNIT_FAIL(test, "segs error %lld", PTR_ERR(segs)); + KUNIT_FAIL(test, "segs error %pe", segs); goto free_gso_skb; } else if (!segs) { KUNIT_FAIL(test, "no segments"); From patchwork Wed Feb 21 09:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565172 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96BE2C48BC3 for ; Wed, 21 Feb 2024 09:28:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CEBE410E67B; Wed, 21 Feb 2024 09:28:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="QNM5aOfa"; dkim-atps=neutral Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by gabe.freedesktop.org (Postfix) with ESMTPS id 77B8B10E4F7 for ; Wed, 21 Feb 2024 09:28:33 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6ade10cb8so13005248276.0 for ; Wed, 21 Feb 2024 01:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507712; x=1709112512; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bJ5a/DjWOVsBkmci+JDRuU6kR6Brs0uJ/9gc+PKy6/o=; b=QNM5aOfanFzSCtKmfQ6fjenXDt8l+aST19g0Vc6tt4+cnKI/mAN+geLb1RopDu+DcC 42LARs3SvfEMZqUaKHCjdovzaUJS6NhTyH/2MqX8rASA+3vVD5uKdJq1jPxWBWODvtII 1AybL4jIm1lnF2Kmt+mijPmK1PJjoW577p6UeLysZ4WooSixJ9JEn97wCTccCqh0F+2U R8f23M0hS3pdnuxvrmDYkc8QW8PDhDWl3Sy45LqhdCnOsUKqloTC82FlT4Dai0mCbCuw VGO+YV/HDer0gW1s68RilaY+PHFTS/09UIKDSqjTlNIbsXywh+7ICc1mmS7QLM+MaLEE dWQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507712; x=1709112512; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bJ5a/DjWOVsBkmci+JDRuU6kR6Brs0uJ/9gc+PKy6/o=; b=nYa8xMpkHKHTuiY8wrHCgLQkG1s9QR9VIw2/dioxUGSMf5Weh+CFuzP02G0geyDwJ6 nnvOuhxEopa5KvcoxzGNg7qLWGmjJvX9AcQPgQDY+3gVyclHfWuuAT9qqLj3v1cWYjKN PMUTV5bCpcexVMUO4bcHEzwwP0y4Q9OPBKuOA688fYhUVIWLT7z/vWapsHspg3gD28Ek Pc+66zDsr/Gn+SYHIaSJQlN3V3ej8zr1JUzH5KMrECeRVRlYxWm6RqjAtfkCvnCkPp0J Fd/sTphqKYS3baT8iYW6KwDm+2n1B9qK8ASyYNQLedc9OvuE4BFPM9JUnrW3gOvXy6yy 6Cqw== X-Forwarded-Encrypted: i=1; AJvYcCURNVmVu49t5Ruwtega2k4SOUpqsiez6XDRPhm6HLZ35kY2Mvf1GhxfynBjwAfFlWKjvQbjtbzRXDaDEhLzlqe9MU3Zkxfb2k+dYSWt0apO X-Gm-Message-State: AOJu0YzVbTQy8soeOVn573jGMhTOb6wqi40SVSc+0LTUkfIzh/xTV7Cc 8kHFguw4TlwBpwd33dTwwRURdWf1++yoDRP3zcomrf9iB+C0zInUX/8lpI0Hy3SJaWvz9p7En76 uwDPmB7odlw== X-Google-Smtp-Source: AGHT+IGGnV8a4VQV8ckgYhdSC+moSz25Q0LZNkggi3KHg0lKbDC7oV4HVzTEvYLgrd72xK+9aVEkald37xppwg== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a25:eb07:0:b0:dc6:b7c2:176e with SMTP id d7-20020a25eb07000000b00dc6b7c2176emr3756666ybs.4.1708507712541; Wed, 21 Feb 2024 01:28:32 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:20 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-8-davidgow@google.com> Subject: [PATCH 7/9] drm: tests: Fix invalid printf format specifiers in KUnit tests From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The drm_buddy_test's alloc_contiguous test used a u64 for the page size, which was then updated to be an 'unsigned long' to avoid 64-bit multiplication division helpers. However, the variable is logged by some KUNIT_ASSERT_EQ_MSG() using the '%d' or '%llu' format specifiers, the former of which is always wrong, and the latter is no longer correct now that ps is no longer a u64. Fix these to all use '%lu'. Also, drm_mm_test calls KUNIT_FAIL() with an empty string as the message. gcc warns if a printf format string is empty (apparently), so give these some more detailed error messages, which should be more useful anyway. Fixes: a64056bb5a32 ("drm/tests/drm_buddy: add alloc_contiguous test") Fixes: fca7526b7d89 ("drm/tests/drm_buddy: fix build failure on 32-bit targets") Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit") Signed-off-by: David Gow Reviewed-by: Matthew Auld Acked-by: Christian König Tested-by: Guenter Roeck Reviewed-by: Justin Stitt --- drivers/gpu/drm/tests/drm_buddy_test.c | 14 +++++++------- drivers/gpu/drm/tests/drm_mm_test.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c index 8a464f7f4c61..3dbfa3078449 100644 --- a/drivers/gpu/drm/tests/drm_buddy_test.c +++ b/drivers/gpu/drm/tests/drm_buddy_test.c @@ -55,30 +55,30 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, ps, ps, list, 0), - "buddy_alloc hit an error size=%d\n", + "buddy_alloc hit an error size=%lu\n", ps); } while (++i < n_pages); KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, 3 * ps, ps, &allocated, DRM_BUDDY_CONTIGUOUS_ALLOCATION), - "buddy_alloc didn't error size=%d\n", 3 * ps); + "buddy_alloc didn't error size=%lu\n", 3 * ps); drm_buddy_free_list(&mm, &middle); KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, 3 * ps, ps, &allocated, DRM_BUDDY_CONTIGUOUS_ALLOCATION), - "buddy_alloc didn't error size=%llu\n", 3 * ps); + "buddy_alloc didn't error size=%lu\n", 3 * ps); KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, 2 * ps, ps, &allocated, DRM_BUDDY_CONTIGUOUS_ALLOCATION), - "buddy_alloc didn't error size=%llu\n", 2 * ps); + "buddy_alloc didn't error size=%lu\n", 2 * ps); drm_buddy_free_list(&mm, &right); KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, 3 * ps, ps, &allocated, DRM_BUDDY_CONTIGUOUS_ALLOCATION), - "buddy_alloc didn't error size=%llu\n", 3 * ps); + "buddy_alloc didn't error size=%lu\n", 3 * ps); /* * At this point we should have enough contiguous space for 2 blocks, * however they are never buddies (since we freed middle and right) so @@ -87,13 +87,13 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, 2 * ps, ps, &allocated, DRM_BUDDY_CONTIGUOUS_ALLOCATION), - "buddy_alloc hit an error size=%d\n", 2 * ps); + "buddy_alloc hit an error size=%lu\n", 2 * ps); drm_buddy_free_list(&mm, &left); KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, 3 * ps, ps, &allocated, DRM_BUDDY_CONTIGUOUS_ALLOCATION), - "buddy_alloc hit an error size=%d\n", 3 * ps); + "buddy_alloc hit an error size=%lu\n", 3 * ps); total = 0; list_for_each_entry(block, &allocated, link) diff --git a/drivers/gpu/drm/tests/drm_mm_test.c b/drivers/gpu/drm/tests/drm_mm_test.c index 1eb0c304f960..f37c0d765865 100644 --- a/drivers/gpu/drm/tests/drm_mm_test.c +++ b/drivers/gpu/drm/tests/drm_mm_test.c @@ -157,7 +157,7 @@ static void drm_test_mm_init(struct kunit *test) /* After creation, it should all be one massive hole */ if (!assert_one_hole(test, &mm, 0, size)) { - KUNIT_FAIL(test, ""); + KUNIT_FAIL(test, "mm not one hole on creation"); goto out; } @@ -171,14 +171,14 @@ static void drm_test_mm_init(struct kunit *test) /* After filling the range entirely, there should be no holes */ if (!assert_no_holes(test, &mm)) { - KUNIT_FAIL(test, ""); + KUNIT_FAIL(test, "mm has holes when filled"); goto out; } /* And then after emptying it again, the massive hole should be back */ drm_mm_remove_node(&tmp); if (!assert_one_hole(test, &mm, 0, size)) { - KUNIT_FAIL(test, ""); + KUNIT_FAIL(test, "mm does not have single hole after emptying"); goto out; } From patchwork Wed Feb 21 09:27:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565173 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7935FC48BF6 for ; Wed, 21 Feb 2024 09:28:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BECCC10E683; Wed, 21 Feb 2024 09:28:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="sAfrc/IC"; dkim-atps=neutral Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by gabe.freedesktop.org (Postfix) with ESMTPS id 023AC10E682 for ; Wed, 21 Feb 2024 09:28:37 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6047fed0132so98282367b3.1 for ; Wed, 21 Feb 2024 01:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507717; x=1709112517; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nYdfpz73mSSQOJip1+ZL+ticY/JfIGD+cYhY46XA/58=; b=sAfrc/ICgjT2kbnhPOzg8pDsskofs1BoFvQVV7gmhJO0Hd09IUxaHmaV9R7QKeB2vK 10yzIhuaj3ktfcE21dA2p1HsAY9eJJ/VRPh2k8taBpHzOxMYoASGpNNB0OsbzB3KY749 Q3Fx7HFAE0BluMhMoD0rn38nKDpRB92hgy1Yl3SdZqFWW2IUCE9naqWyqNN0+4gBldst N/kdfYwaakFJ6megJVOpFjZrjmh6ek821sMlej+m2iCxaB+8iRe72RrkCFVI3vw9jnDX KSvPX+hBDNNcS/q8EuuR58tGeTPoZ1YFVi49qDyVMORnq2Tw/hyNO0WJ0JiytRxz8j2s zuRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507717; x=1709112517; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nYdfpz73mSSQOJip1+ZL+ticY/JfIGD+cYhY46XA/58=; b=w/DEEd5y+M03iBqqbJAa+XzBEDnLrGoEcYVAj/onelYPS2BMhbwgIUNlle+2J0V0OG GSLEKyzcmvX1dmWy3/xf64jTRVc+xrFv6heNS5SwwW3LQSJ4ihHsMEIUv8eQyz4b+wK8 6DXX6mXvHt2bNmEkPwGnFRd9N84l8fLCQ7wx5p9P/naRPALhNkGDSQACqsFcRQMPtb0s +ydqemotlwfKLSc3pLr1sJnMint4uYiRLAswDKJ164czVQ4OE5v0DxVwsBpRtqmkbR2b J/4KJLzY1v3kdS1T0+KQSfcof/sLPi/wkgrAeiaDd+nn/N0mgas0BBW1QbRGh3ZlDVXe +F4Q== X-Forwarded-Encrypted: i=1; AJvYcCV5ik7SnqMyVpY8xH9h3lK2KUACSDvT4ZNqCz4JhCZ/WjiZo9qytEUz5/iN69b5vOtgo8YlJytEysUR1ez5iefo5TfBGvydjTiHLPaB3Z0m X-Gm-Message-State: AOJu0YxbnYlinQU2Ybj+5eOQQKfxR/D1mETr6Q1g+SLh/cbqZHK2KdPi bLIRDBgmpbXM62wlhgVwkslT50a+4cZLyCvHMaDmZephx3gLpBWx6OfrpOGoYsPjR7K58JLNGfh bs9/e9PMjDg== X-Google-Smtp-Source: AGHT+IFa/fu29ZmsVki9pPhB5PrTsNvq7jb5hiZUPefFb8PbN6D0cYOdutojAKCl/4VlBY7r3iK54hwJmjuHsQ== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a0d:d685:0:b0:607:7564:a830 with SMTP id y127-20020a0dd685000000b006077564a830mr3019910ywd.0.1708507717035; Wed, 21 Feb 2024 01:28:37 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:21 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-9-davidgow@google.com> Subject: [PATCH 8/9] drm/xe/tests: Fix printf format specifiers in xe_migrate test From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" KUNIT_FAIL() is used to fail the xe_migrate test when an error occurs. However, there's a mismatch in the format specifier: '%li' is used to log 'err', which is an 'int'. Use '%i' instead of '%li', and for the case where we're printing an error pointer, just use '%pe', instead of extracting the error code manually with PTR_ERR(). (This also results in a nicer output when the error code is known.) Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Lucas De Marchi Acked-by: Thomas Hellström --- drivers/gpu/drm/xe/tests/xe_migrate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c index a6523df0f1d3..c347e2c29f81 100644 --- a/drivers/gpu/drm/xe/tests/xe_migrate.c +++ b/drivers/gpu/drm/xe/tests/xe_migrate.c @@ -114,21 +114,21 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo, region | XE_BO_NEEDS_CPU_ACCESS); if (IS_ERR(remote)) { - KUNIT_FAIL(test, "Failed to allocate remote bo for %s: %li\n", - str, PTR_ERR(remote)); + KUNIT_FAIL(test, "Failed to allocate remote bo for %s: %pe\n", + str, remote); return; } err = xe_bo_validate(remote, NULL, false); if (err) { - KUNIT_FAIL(test, "Failed to validate system bo for %s: %li\n", + KUNIT_FAIL(test, "Failed to validate system bo for %s: %i\n", str, err); goto out_unlock; } err = xe_bo_vmap(remote); if (err) { - KUNIT_FAIL(test, "Failed to vmap system bo for %s: %li\n", + KUNIT_FAIL(test, "Failed to vmap system bo for %s: %i\n", str, err); goto out_unlock; } From patchwork Wed Feb 21 09:27:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 13565174 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 399D6C48BF6 for ; Wed, 21 Feb 2024 09:28:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 93D0C10E4F7; Wed, 21 Feb 2024 09:28:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="q9woSA6z"; dkim-atps=neutral Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by gabe.freedesktop.org (Postfix) with ESMTPS id A868A10E682 for ; Wed, 21 Feb 2024 09:28:42 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dbf618042daso10802698276.0 for ; Wed, 21 Feb 2024 01:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507722; x=1709112522; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=UtSX1a4twDclpP0XCHq3xRlg28EKI7v3CFBboD2ALTI=; b=q9woSA6z3OFhNshtrJy2C+p0cuBXQHCgZhZcPUOkN69SCrBZggDP4dh8ZWYQ49B7xE CYNu5MAHXdA03ImOwMx4cLQhFJd6bW7/j8V2qLOlW6YZ9Ym6pgaZtHHYJGy6bhcr3o+d mZeA6qRYD6NSBa7hV7XD77H8LJgr0hnxH0P7yQiJrLe2DS5fxRBPdKaKydOa1v+odx6k /k4GRRo9HME1+RDGLhHAcp/cweLmurXJ4UES2fSDM/+giobT8p0mPBG+acfuR0dlAdyS c465C0FRb6dt79vYKqWQgGgNjWXkrkChAo5dPHO2LjppylBFsv9yAKIzPg8MFFnjlLtd 7ylQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507722; x=1709112522; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UtSX1a4twDclpP0XCHq3xRlg28EKI7v3CFBboD2ALTI=; b=tVa9ioKFsVrolGRgBX7CQJrwLrVexE1k3HAEfUOXwf6hqArtTrNZXhyKEvru5PzNXg ELZjn7sOfn9T8HzEWi4/kj28k0vfyKE/HlTwKjmPRkIeh/3NBthQdOAsdkrxHlHltKYw AUxGLXJfH7ZS59tv/0IxsoJmGGNwMv5pJff4Rtzlx9umGTLEPJcSXn6/MMPNFPqTmB6V iaWc4fsJd01ima7VA2iC0nv5PcstsGtx4FgBQhiF92UqUdqKtpIEshlo5GDqbiMCqAl4 mgrt2RoHUTwoDlQ2irZ+L53VLZTfqgXLlBiRlKCmYxfvKuXpwBV7oU4XHOaGm+1VAXir dDcQ== X-Forwarded-Encrypted: i=1; AJvYcCWLi5JVFw9PnR06l7hY/tB2egDWiy4rCPP7Iwb1fy3s4yhRhfhwD3trCGP7hV1c4ZoMq7nOoiWlfs/3e+uF86WM3EXcm/qmj3DEXBAzW+xJ X-Gm-Message-State: AOJu0YyvMtrI4jzZHd9P1Ung2tOXW2kS54/B5xJHKFqQmDH1rvzODX8c pkO87BMKE9/ZYs1mvHsIozuae+HozqNm0e+b+aQ8Ac2N0UyWYcB+la6wD9xgSlmjQfeD50wpkYB AvqIK4XT1ow== X-Google-Smtp-Source: AGHT+IE+u4BHsnTY4zBV9uwlLnSALfH2VACViqUl+6ZdsI4Ll1wRpv0qUeWfBww+/YNGvG/0sUR+LBCAIAUp6Q== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6902:4ce:b0:dc7:865b:22c6 with SMTP id v14-20020a05690204ce00b00dc7865b22c6mr618682ybs.8.1708507721736; Wed, 21 Feb 2024 01:28:41 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:22 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-10-davidgow@google.com> Subject: [PATCH 9/9] kunit: Annotate _MSG assertion variants with gnu printf specifiers From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" KUnit's assertion macros have variants which accept a printf format string, to allow tests to specify a more detailed message on failure. These (and the related KUNIT_FAIL() macro) ultimately wrap the __kunit_do_failed_assertion() function, which accepted a printf format specifier, but did not have the __printf attribute, so gcc couldn't warn on incorrect agruments. It turns out there were quite a few tests with such incorrect arguments. Add the __printf() specifier now that we've fixed these errors, to prevent them from recurring. Suggested-by: Linus Torvalds Signed-off-by: David Gow Tested-by: Guenter Roeck Reviewed-by: Justin Stitt --- include/kunit/test.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/kunit/test.h b/include/kunit/test.h index fcb4a4940ace..61637ef32302 100644 --- a/include/kunit/test.h +++ b/include/kunit/test.h @@ -579,12 +579,12 @@ void __printf(2, 3) kunit_log_append(struct string_stream *log, const char *fmt, void __noreturn __kunit_abort(struct kunit *test); -void __kunit_do_failed_assertion(struct kunit *test, - const struct kunit_loc *loc, - enum kunit_assert_type type, - const struct kunit_assert *assert, - assert_format_t assert_format, - const char *fmt, ...); +void __printf(6, 7) __kunit_do_failed_assertion(struct kunit *test, + const struct kunit_loc *loc, + enum kunit_assert_type type, + const struct kunit_assert *assert, + assert_format_t assert_format, + const char *fmt, ...); #define _KUNIT_FAILED(test, assert_type, assert_class, assert_format, INITIALIZER, fmt, ...) do { \ static const struct kunit_loc __loc = KUNIT_CURRENT_LOC; \