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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z8hHrIz2wwAMtQc8@pathway.suse.cz>
Date: Wed, 5 Mar 2025 13:46:36 +0100
From: Petr Mladek <pmladek@...e.com>
To: Tamir Duberstein <tamird@...il.com>
Cc: David Gow <davidgow@...gle.com>, Steven Rostedt <rostedt@...dmis.org>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@...omium.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Shuah Khan <shuah@...nel.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v8 3/4] scanf: convert self-test to KUnit

On Fri 2025-02-14 11:20:00, Tamir Duberstein wrote:
> Convert the scanf() self-test to a KUnit test.
> 
> In the interest of keeping the patch reasonably-sized this doesn't
> refactor the tests into proper parameterized tests - it's all one big
> test case.
> 
> --- a/lib/test_scanf.c
> +++ b/lib/tests/scanf_kunit.c
> @@ -15,48 +13,35 @@
>  #include <linux/slab.h>
>  #include <linux/string.h>
>  
> -#include "../tools/testing/selftests/kselftest_module.h"
> -
>  #define BUF_SIZE 1024
>  
> -KSTM_MODULE_GLOBALS();
> -static char *test_buffer __initdata;
> -static char *fmt_buffer __initdata;
> -static struct rnd_state rnd_state __initdata;
> +static char *test_buffer;
> +static char *fmt_buffer;
> +static struct rnd_state rnd_state;
>  
> -typedef int (*check_fn)(const char *file, const int line, const void *check_data,
> -			const char *string, const char *fmt, int n_args, va_list ap);
> +typedef void (*check_fn)(struct kunit *test, const char *file, const int line,
> +			 const void *check_data, const char *string, const char *fmt, int n_args,
> +			 va_list ap);
>  
> -static void __scanf(6, 0) __init
> -_test(const char *file, const int line, check_fn fn, const void *check_data, const char *string,
> -	const char *fmt, int n_args, ...)
> +static void __scanf(7, 0)

This should be:

static void __scanf(7, 9)

Otherwise, the compilation with W=1 produces the warning reported by
the lkp@...el.com kernel test robot, see
https://lore.kernel.org/r/202502160245.KUrryBJR-lkp@intel.com

> +_test(struct kunit *test, const char *file, const int line, check_fn fn, const void *check_data,
> +	const char *string, const char *fmt, int n_args, ...)
>  {
>  	va_list ap, ap_copy;
>  	int ret;

Otherwise, it looks good to me.

With the above fix:

Reviewed-by: Petr Mladek <pmladek@...e.com>
Tested-by: Petr Mladek <pmladek@...e.com>

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ