lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240221200204.frzov7n5bxb4cekd@google.com>
Date: Wed, 21 Feb 2024 20:02:04 +0000
From: Justin Stitt <justinstitt@...gle.com>
To: David Gow <davidgow@...gle.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
	Shuah Khan <skhan@...uxfoundation.org>,
	Guenter Roeck <linux@...ck-us.net>, Rae Moar <rmoar@...gle.com>,
	Matthew Auld <matthew.auld@...el.com>,
	Arunpravin Paneer Selvam <arunpravin.paneerselvam@....com>,
	Christian König <christian.koenig@....com>,
	Kees Cook <keescook@...omium.org>,
	Maíra Canal <mcanal@...lia.com>,
	Rodrigo Vivi <rodrigo.vivi@...el.com>,
	Matthew Brost <matthew.brost@...el.com>,
	Willem de Bruijn <willemb@...gle.com>,
	Florian Westphal <fw@...len.de>,
	Cassio Neri <cassio.neri@...il.com>,
	Javier Martinez Canillas <javierm@...hat.com>,
	Arthur Grillo <arthur.grillo@....br>,
	Brendan Higgins <brendan.higgins@...ux.dev>,
	Daniel Latypov <dlatypov@...gle.com>,
	Stephen Boyd <sboyd@...nel.org>, David Airlie <airlied@...il.com>,
	Maxime Ripard <mripard@...nel.org>,
	"David S . Miller" <davem@...emloft.net>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	intel-xe@...ts.freedesktop.org, linux-rtc@...r.kernel.org,
	linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
	linux-hardening@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 9/9] kunit: Annotate _MSG assertion variants with gnu
 printf specifiers

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 <torvalds@...ux-foundation.org>
> Signed-off-by: David Gow <davidgow@...gle.com>

Reviewed-by: Justin Stitt <justinstitt@...gle.com>
> ---
>  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ