Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2589010rdb; Wed, 21 Feb 2024 12:27:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVXHMnIXLqVrCadxp2zQsOgfp4NgL8Lhoy4sPfdJOH8HNZ6aBFtO4ZjyQPUuedRLB21LgpaXNLUvJMK92QopLTFXNkdtmgyiSvEzQTrPg== X-Google-Smtp-Source: AGHT+IGNPjIQL07I6VjyOA1uykUmD7tCcucFUH+d6sxwwVyVbMudMBTbPNY8VGhZzWlhNGoDGbng X-Received: by 2002:a17:903:230e:b0:1dc:248:28e6 with SMTP id d14-20020a170903230e00b001dc024828e6mr12014431plh.67.1708547254983; Wed, 21 Feb 2024 12:27:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708547254; cv=pass; d=google.com; s=arc-20160816; b=B+cCdEi5vtLjWe+8ZKSgzDXgn4EHz0jFR9nvGfXrQ9GWXLU86vA6AnRQ32fO474XXz beWYy2mEzTWI8MHq+wzKWk7tv0lWF48tByv3EojEtP+xly7A3OkBavHszdRuooNleGS3 82JQ+IbJze1ocX2SS5o5zYPIy6M+1orab/DNpUFy/Clj9zq1Be4XUcWrkHaUp7EjiEAv PrLHZ5zUrYkkucxf6vTAdScCpkY9zNu6AtYQZnN7FdUAb76bQjlHlCtOlMe1c1H7sGr9 sZrKTOtKxOHQ35nkM5u7ApyA3XpHBlG50cYj3d5DVEcJfQ2l8ov918Zu7MAMBVBCnUaa /bJw== 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=hW/eD+217SwbFSrd+7OlcqgqqQaX2xcDsJgsLrnW3ms=; fh=wqnUB3JJFfekkAh+3ddz68rybF9sk1TCdv2j+XUV6as=; b=AELU2xAzen2BmGAAYafF2T6/z8bFf/DZ1uWud2kqnd2TjtOZ9Xb5NRvgFk6xYNw7A4 letIi/G8pxGrKSludZjqDgLQBU09isTU18mIwMBVqF/dVFXs2zHW0GDsh+cKK0DWuiuK HoVAuEhzfsg4O/6hu9ff3AW5UPumHpp7d9GgemgyHVLnAJmAYiYXM8zVlqyiqxPAHTdv jyVo7KdUJCrbO4q5lcOA9OYtxRQalssBq9IqxantAa5KBDaMlJdFmxXZ/yPUTCv3RMDl XCTk6WGtD7oTcWD/QWG90tHmWZTi6W5wOVo7YpUQVLGkjzWbbnjQW9wk6bOHNcpWKasy JIJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bLAOop5P; 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-75440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d19-20020a170902c19300b001db9a8c7794si8492588pld.82.2024.02.21.12.27.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:27:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bLAOop5P; 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-75440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75440-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B7B23B28D0D for ; Wed, 21 Feb 2024 20:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A88A2127B50; Wed, 21 Feb 2024 20:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bLAOop5P" Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 116031272AC for ; Wed, 21 Feb 2024 20:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545733; cv=none; b=Fk49iTJlod7AU71JhSzT8VSmaD0Whz9woft5vG5Y1PNn0qy+khFnk8HdkNmPWiNnSHGYWtFkOHUEXRiI/Nvkidlm5tzXBOJ9Ui220bLmui0vyWRS8dLFDyvJbHghRKq4lhOoeGyiclrn4AFijQWY96WqpPT7zj+yDB8ogsNkONQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545733; c=relaxed/simple; bh=b48lXPZQ+02Q0x3yLHzWYedk9fLZtBBvGY00YBRj8DY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jU/0i5KBDwTt3u3T5Zyj/c8CWNYmgDusFnb7LItyQf1xJlfl03vUU9CSIXB5jn1EVClAZXZjJLjVcJn19WREJlk29wfkck0jQt2/A6678KvkwR5zaeEl/lCqdGLTOJAyODwEliYjQrYnH6x7im5idra9VEYK4mLcPYeFoMBkH14= 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=bLAOop5P; arc=none smtp.client-ip=209.85.166.46 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-f46.google.com with SMTP id ca18e2360f4ac-7beda6a274bso41470739f.2 for ; Wed, 21 Feb 2024 12:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708545731; x=1709150531; 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=hW/eD+217SwbFSrd+7OlcqgqqQaX2xcDsJgsLrnW3ms=; b=bLAOop5PY9nIMWtJBK0X4o+9ohSJFVebjUsn5fEj/Pbi+RE3nBNv6UFiiGyj6gA4VP pw/74OJosTSnESt4IkCbHrL0tmvqRKVB5IvGRf9Nm8/XA8ByA7rBWnFCW/e+zoGfCNra gqu3oc9ctgVEHwA5BAptS2Br5zo13+P6//I5mQS6ApOiXciEAiNr5iQXdGMvSak2iFqq xzAmtlZRJx5Yd6RPxRa5QN45nmqIt7wH9SBhG7NwCB8v87ZmeCSNwvAarFSFN7cr4nOC 6VSfgJLNSN2sTx5EDAcjRtb4F1wjF04ac1lIpq+fCMpOA/TZVcInz0aPFxfP6sNTsMUX GnXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708545731; x=1709150531; 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=hW/eD+217SwbFSrd+7OlcqgqqQaX2xcDsJgsLrnW3ms=; b=s4q9uJTc4HDUCtVRqGQs0Byc/VdDChxF88ekTMpyEMcInvbthV+zirxGpjt+oquw/8 tWmhS81++EX2cOm6B+WT6XAcVKmmmjybLAWh7jS7x+QPKj9Ji4N8j22T1Fh1nOyE/Bhk i1QI2OAbPunUT+ozHARCXn3krqUYVCky0r+zmczbnK9sF7Bl9/XPMdYSl/XvsE1XB6e6 OL3487d6fnFxIwk2U1fXhpHPv/N/eRTZku5KzRO4gukDDHqrPKF+BGpvPyd6WDdyfas3 saPMqf4qZs/w1DgZBibLr5bbDqyIVphVJS4gURPnYaBqGr8VN3OcDGTgai44II4F+I0T fAAA== X-Forwarded-Encrypted: i=1; AJvYcCW0KeZFQwIOUxvVnuKO3ijZy63TD8fksWAMqgm380llhE1UVmcxS+6zCZh9HjEVXUzqCa0v1kn3kKbNg/6gaHHQk6ZA4WDkpLT2pdne X-Gm-Message-State: AOJu0YxSJNX4Lq9QVwPoIZLpr8kA2WWhJUJlRSiug8p/+4SvSa1G+Fyj 4K0Epug0KkHR2v72VcM16/iRK0EGveIqXaR/DzbRHgZSh9DnycLv3PJSKhHDRQ== X-Received: by 2002:a5d:929a:0:b0:7c7:4d7e:de87 with SMTP id s26-20020a5d929a000000b007c74d7ede87mr10763875iom.1.1708545731187; Wed, 21 Feb 2024 12:02:11 -0800 (PST) Received: from google.com (161.74.123.34.bc.googleusercontent.com. [34.123.74.161]) by smtp.gmail.com with ESMTPSA id fv5-20020a05663866c500b004741f7683ebsm2243287jab.154.2024.02.21.12.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:02:10 -0800 (PST) Date: Wed, 21 Feb 2024 20:02:04 +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 9/9] kunit: Annotate _MSG assertion variants with gnu printf specifiers Message-ID: <20240221200204.frzov7n5bxb4cekd@google.com> References: <20240221092728.1281499-1-davidgow@google.com> <20240221092728.1281499-10-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-10-davidgow@google.com> Hi, On Wed, Feb 21, 2024 at 05:27:22PM +0800, David Gow wrote: > 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 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; \ > -- > 2.44.0.rc0.258.g7320e95886-goog > Thanks Justin