Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2360960rdb; Wed, 21 Feb 2024 05:32:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUlSkb8oeBN36piTtCLWLlxXSwLzC+X6OLeOaKaP4ZNL2ZYIPrRg1lYQRaZOIs1Gy21qG6tQ6PIf3NxFXlLDspoBL6hFYCg+tZ+CWuMQw== X-Google-Smtp-Source: AGHT+IEnpDIy6qGdHvfNzV7W07XkVafNoV1RsitULUOf+GBqx37bTOOYN8QP/7anA/OLfwW4/C8O X-Received: by 2002:a17:90a:ca84:b0:299:4f75:150e with SMTP id y4-20020a17090aca8400b002994f75150emr8399566pjt.47.1708522355292; Wed, 21 Feb 2024 05:32:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708522355; cv=pass; d=google.com; s=arc-20160816; b=mjC8lDzpdxVBfG/LFqpgAjr9BPjCclOX68L+8dYtvWA9fFU12GNlRf4JLnR5dsMHT1 IpCOkYWaXZNj9Zwq6lEyF893uUsOw0/CAo5wuZkEjsCToeOsXtifVYB07Ts3Rq9S5yVQ cDkVfTbaTIXwokEFWV2gVJyL/u12Ab3LI9TsmrQksAPALYzjE97CGn+GXn9vdx08hFXr fL4SyftT8Y5Raswo7vEJTXauHg/4qA03XsHY3755TSP0hlOAu76yxxSw9yDahQIe918S BoG1neDJqlRTaDt7AWiH9X2/gPPrp3Il21ret41kkdihUaBhrpA9mKim8vk+qdx520Wi EGzA== 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=FIcGpMiTUFuShIJcNZW3Z6nnK/vjwEkJ2H69Fs4AHDY=; fh=E8lgVeUcgxc0rsMVmGq6dQpzrm3442fexWycxwXfMGE=; b=N5immEEKhrV/U5srqJZNxxyeSjiOB/ph8C2bmqSET3mjOlG+NBtHvQhRmyEYTJP8xb pwR6jEnnEFgE9fmmix+SxwGpbOM0WLBlGFfFVEeUys40e2VACUVLYYJj+J/ZiwXuxUcq NmRMwq0Moeq+OoCCfOAnmFw5eF49goO1ruVnGCknmPsCOx2TzupKvkZqIxZqAdZ8Ykfk nON4tb7xegkCqaMNw2XvYM5aFlmjS8aEcGBSNMI6D6xpM2oFkQ+OQLl3bCcJQswZtJZm ngfq5sonUNy5HYgSvWZdMtJz6lTtN+en/ndOLLC5qr+xyLU2dVBU9ftGtxtAXeTftv1H k5Pg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NPCRgmP6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74797-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74797-linux.lists.archive=gmail.com@vger.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 sk12-20020a17090b2dcc00b002997b797a93si6511206pjb.182.2024.02.21.05.32.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:32:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74797-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=@gmail.com header.s=20230601 header.b=NPCRgmP6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74797-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74797-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E1EBD284FE0 for ; Wed, 21 Feb 2024 13:30:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B70208062F; Wed, 21 Feb 2024 13:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NPCRgmP6" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 E55C377A03; Wed, 21 Feb 2024 13:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708522009; cv=none; b=tUBhex5rP2D2nlxGxBpuPs6H+fjYscESmLK7uHEDdzJ5L/pAKdk1Pp2aD8qnBMJE//nEadaiMb1E7PwqGOz1IzKOKoagy9knsBlos6SgY4UPIqJJC87a7qJpmHK01wdSWEfpi6mLF+Q/9q2oDwtMoRd6OrapXShNdC00tNtXlew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708522009; c=relaxed/simple; bh=F+O2jT8N2BIEGIYwYUqoDBWQmBTa2NMIDug/qqNZ5Hk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r04yEurEDpr3HyNMrW9P76bBshc2fjFDTXNjjmH8DE4ifk6b61Y3EoexiF+7ZL5I3sHilsu08vDWHlHeE+7z4xoqVQazurRC21fNW96puGXjKnSxXY5G/h7ROFEkML/xsC+1uyeR7WMZNVpbUXxDgJVkBvGIIPcL69AMGxxBrvo= 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=NPCRgmP6; arc=none smtp.client-ip=209.85.214.169 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-f169.google.com with SMTP id d9443c01a7336-1d731314e67so47519845ad.1; Wed, 21 Feb 2024 05:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708522007; x=1709126807; 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=FIcGpMiTUFuShIJcNZW3Z6nnK/vjwEkJ2H69Fs4AHDY=; b=NPCRgmP6U42OtlkgqwEWc6Rt5ApAtn4Z8GzHJ0ECxDbWb4EKPx/2r4SHjW0Avbfk8p Zk7Wd02iO/qlmC8A2xm9jjiOxeo6Aitn4YqnHLaETgWC9iPRIwE1VYy9aUIL1M/4XN4/ 2uEyuYER3WuVaDfxYbcticsRCZL7mOeRB/uYmeJjsguCA5zHETBMw2J5qd6TBZu3nSaC R7sBOgvSH2QfB/Ua19ZJDfgU+SbvJaKBfAYlcStr3A0uvFQpZfzD1nSeGLUNOEPZAfp5 S0vc6Xzzc/9mTj8ExmtawE4V+FFal7dX1X727PaYl3cGzcWJDaAHkruVIFMFTAXJSa0x Ambg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708522007; x=1709126807; 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=FIcGpMiTUFuShIJcNZW3Z6nnK/vjwEkJ2H69Fs4AHDY=; b=bZ3lacwWWojrYnGaC8w1zvAdIA9DGpv5kN2bb1GYI5/khh7A3DvmBUBpJzAtNkcAJ6 9t8DxNWROUk8ymVIkiaPwiyne7ZZ0Qum8dqtnDnSoMR1cBAYmyntP3zGwDNfCEvxD73c FIE/OdoxOI37jrAufCJYLAxUdtSx42AT/bkPeGwlDM3EonD91sbJXOLAVR04HgaEawLO ZimtWRUGOqAg4QQFwNTArfNA/oJobItNmYQ8wOMpJ4EMi/bfa7NA2/oFfSfGcXTpx8FF m/jEi6rZdwzShJVLcerHqCyHFgkiMcEbF/VFDocliGJR2YA7We1VScI4iyqqyNbvvO4Q X+1A== X-Forwarded-Encrypted: i=1; AJvYcCXJJwznjKjIxLDgvJgIFwKiBJA9sHCIYnkIqMPSgLhpiPnbkXTbPSjjmjYhi2jMJ9G8pJolzGVzMsisd0nysMe20AXFaAJiSiaFsOpX/Cl/B1S+DuG7vm0Vr6WuQ28VAcmBf60NzjbsT6UTCfML/hNY5nArxdu39XudaBcEv0OsBgsx6I1lVblvzMAL07BGr0mMd7EobL3dLVUV1mw8GD/7jDondWS+Od7cUaR2Qs3JC3VW5J3fZP8+uXgowUYriXgv X-Gm-Message-State: AOJu0YwHZNjWjrqxU5vCWDIRGyTmNsT/gbIFxYR+IIXO/ICwOH3f5HIk knuw6lSKKuF0s1YqWA85rEkYIGkGky0q2FMxqaJFEhey8DdVrvCP X-Received: by 2002:a17:90b:3b50:b0:299:6c4a:c5f0 with SMTP id ot16-20020a17090b3b5000b002996c4ac5f0mr8381795pjb.9.1708522007304; Wed, 21 Feb 2024 05:26:47 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id h23-20020a17090aea9700b00298c633bd5fsm1699769pjz.30.2024.02.21.05.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:26:46 -0800 (PST) Sender: Guenter Roeck Date: Wed, 21 Feb 2024 05:26:45 -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 9/9] kunit: Annotate _MSG assertion variants with gnu printf specifiers Message-ID: <678b4b1b-6319-448b-b6a7-7692b368bf31@roeck-us.net> 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> 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 Tested-by: Guenter Roeck > --- > 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 >