Commit d3772e7b authored by Maciej Wieczor-Retman's avatar Maciej Wieczor-Retman Committed by Shuah Khan

selftests/mm: Substitute attribute with a macro

Compiling mm selftest after adding a __printf() attribute to
ksft_print_msg() exposes -Wformat warning in remap_region().

Fix the wrong format specifier causing the warning.

The mm selftest uses the printf attribute in its full form. Since the
header file that uses it also includes kselftests.h it can use the macro
defined there.

Use __printf() included with kselftests.h instead of the full attribute.
Signed-off-by: default avatarMaciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 07bd3c38
...@@ -338,7 +338,7 @@ static long long remap_region(struct config c, unsigned int threshold_mb, ...@@ -338,7 +338,7 @@ static long long remap_region(struct config c, unsigned int threshold_mb,
char c = (char) rand(); char c = (char) rand();
if (((char *) dest_addr)[i] != c) { if (((char *) dest_addr)[i] != c) {
ksft_print_msg("Data after remap doesn't match at offset %d\n", ksft_print_msg("Data after remap doesn't match at offset %llu\n",
i); i);
ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff, ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff,
((char *) dest_addr)[i] & 0xff); ((char *) dest_addr)[i] & 0xff);
......
...@@ -34,7 +34,7 @@ extern int test_nr; ...@@ -34,7 +34,7 @@ extern int test_nr;
extern int iteration_nr; extern int iteration_nr;
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((format(printf, 1, 2))) __printf(1, 2)
#endif #endif
static inline void sigsafe_printf(const char *format, ...) static inline void sigsafe_printf(const char *format, ...)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment