Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2250749rdb; Wed, 21 Feb 2024 01:32:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVxLImASDPfkHugy15lTwiuJHchmPqpS6RC1m/ouYWGEZ1L2ofrNwlBHirSUQ0fcdosnSmOj4cVo39Tt1aHd33+80bTuO3JqEHDOFFJSw== X-Google-Smtp-Source: AGHT+IExIujdnmPodFclreASYYyp3GHXdTWxBpP7ON61gvDkaXEEgbFMpp2VPTHceiU0TcNMVYPo X-Received: by 2002:a05:6870:2214:b0:21e:5008:cf62 with SMTP id i20-20020a056870221400b0021e5008cf62mr21337512oaf.21.1708507970044; Wed, 21 Feb 2024 01:32:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708507970; cv=pass; d=google.com; s=arc-20160816; b=zQFORJH6ayhEEoWjYmMAG07VpNTIaAUzhki50DU1ZSNqtSPN1GAuspctglmNdA9UYZ wGxwpSjVCP2Y9UKLloKpVvsa7dXZYxiAsI+wRhMKYy8PTZLZyDFJqI5/Vrp9FfyWFLuP 46QoxNx9HvY3DQHOORavHTQ8Cbo/tzXzeHcAgfh+zXK7MvF9MFpmu5kLA8sq5uVqpkty cpaDU+BUYhp1HX5XOPU25+254UL8XiofRzNVTNIt27MCvYzporOQ770FDiA+pHViEuQv 7cKrr9/6DBUt7a3xvdJvvChgH4tzTy1RfrME+oQTlFdx1+Zos8jsTW9EYaY1uIXwaMuU DUrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=UtSX1a4twDclpP0XCHq3xRlg28EKI7v3CFBboD2ALTI=; fh=bexjERJRsUvNDOjp9bNUsz9hgrUDE1mCg2IdPSJXGQk=; b=y+vBsI2oqg4IsCvTUSY4scw6BG3ubM2jcJyhoJjVvd37LJrsv8zJuqP9+THIbjHKa/ bX2Ln00Fl372nQw2KLuTKEKKyR8WQPMdcdKNpdxdbsi3FLMIYNCKgXxipg7nXrG4HW+M wyyTtjTnH/ToH2+A6Igemk8Sni9bjzO4eF7uRjPefb7XFj0Sw2XRslIkeFhvxsH7T0tb nt94waHYkjHyDT0Vw7ajkrGSCCSoEou0tYpl3JFgp1quPW3zodomn3npR0L2OxBf0K6c Hj7sOz/KC0EH8p8+Vqd0gHeZ1+BTrp0I6vaMTmj3LMzrWnjztHbiMHf/YPWUFGfYgbJY 0DxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=lGexlX5D; arc=pass (i=1 spf=pass spfdomain=flex--davidgow.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-74412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l1-20020a656801000000b005dc71c7b944si7841920pgt.144.2024.02.21.01.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 01:32:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74412-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=@google.com header.s=20230601 header.b=lGexlX5D; arc=pass (i=1 spf=pass spfdomain=flex--davidgow.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-74412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74412-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B48FF2834AD for ; Wed, 21 Feb 2024 09:32:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 423C747A74; Wed, 21 Feb 2024 09:28:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lGexlX5D" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 A015F47A5C for ; Wed, 21 Feb 2024 09:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507725; cv=none; b=iyiaW+rT/+rTPdZQP1MH1sqEwrYI1GLjwrqEjy8m5wJBqS4vFIK9LEYZDnQ4IFBZ7Nb6fC699Wh927MIko4dWPqbIbfbVKIeqncsnKZwqQ9cpe/5D70GUwwCxcEzd3Ca7n1kesV2Mh1cw76qJflNrj3djEYkdK4l2s/3tHFy9pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507725; c=relaxed/simple; bh=MALY8PY87om1B5rM9PQyZB962vp0AzyA5B9YGRQAQS4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NdTpx34DrchJ8Bi2Wu96GQBFc8mN3LdAwN27BpKNIH5kdS2Sth9jRmrlzP56D9PA8t2+DQ32dfjR2tFCKPLuHODUMZHH/sTJRGxoyJEVbSNouiAQHhjbB3XcXjYAWrkbtDbH7hhjN52COH0SzQ105EXPTkTDT1sTdr2vyNZpTJk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--davidgow.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lGexlX5D; arc=none smtp.client-ip=209.85.219.202 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=flex--davidgow.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc743cc50a6so8825702276.2 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=1708507721; x=1709112521; darn=vger.kernel.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=lGexlX5DBntYPjEQG6RjJ0FVsKToWINsWjjn43Ml34EhA3IoPvQpeE+rqHUk3I1I/h YznQjIDQnf+vGqDW/kE++pZBmelMsM/USqvYQHr9gSb8/+c4pFYCh7xQghyqkqpDjBSJ CK6jy8ETBZ8fpAclaaj8ACUDL7WGn0N58iow8E2+Hu5NljOEGw0Ji+v+2zJS0XvqjevZ ddlYiladtiHjXz/w5QM5wsloX3M1b1R/10seHUoVMyoQsDzYexETHOm7y0xkt4FASDMm tweykBtRw4lxmqPktku7Bo0UQJ7if4UHTAXpEBAAJMdODHBZDVEyJBzLvszgVsi5PiM+ yf5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507721; x=1709112521; 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=sKva/MEZvD+xTq0YF3x7vndCNnG5fX+A9SYd0yFqIo8is/6vxMztfZTJh9M7yEOKJG 6bMcUXv9+jsr5i2GkU17UPe/bwKnAe/XBou0rFg1PJPyLdXnXSLkRbLRsTuZTH3emwsc 1O71U1hCfyjnHduBmObsRsSTe6bDI78No5DSg9zwO5DCJQLVg41Ua5yyUzTvZovuVOB5 aJpOkqJjdIIQKU1cEnb7fua/ZVJKIH9O9oPnd7VJCClDqGPKJkhpgi9lF3W7iZGxs6Q0 1B1lEXxccLBmN2pF8nY4/+B5KO6u15Io9gFJq6BYE+xMudquFVetqPbEOzevnfYpUOYb oTaA== X-Forwarded-Encrypted: i=1; AJvYcCUo8IFVAf498MmRqpU8XZjw3+djzC65sC8QyOMgG3+q01ugUwy8UCo1ipiOA7dUrvaGdc+D+rNxXmr3ZDV8b5jVZldvQ06eU9SEGVHJ X-Gm-Message-State: AOJu0YznHre0hRqJ6kb1z9sxkq7FgFL36FQYo+seesKGDWvzN9nP4051 6Y04MlEW5jsplM+tt4SOS7SEdbhrlWqS9rTP1AgFktL6joQiZ97VRk2gN0CRwKAnO1DJBJh0U28 pr70RtwmOLg== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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?Christian=20K=C3=B6nig?=" , Kees Cook , "=?UTF-8?q?Ma=C3=ADra=20Canal?=" , 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 Content-Type: text/plain; charset="UTF-8" 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 --- 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