mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
selftests/proc: fix string literal warning in proc-maps-race.c
This change resolves non literal string format warning invoked for
proc-maps-race.c while compiling.
proc-maps-race.c:205:17: warning: format not a string literal and no format arguments [-Wformat-security]
205 | printf(text);
| ^~~~~~
proc-maps-race.c:209:17: warning: format not a string literal and no format arguments [-Wformat-security]
209 | printf(text);
| ^~~~~~
proc-maps-race.c: In function `print_last_lines':
proc-maps-race.c:224:9: warning: format not a string literal and no format arguments [-Wformat-security]
224 | printf(start);
| ^~~~~~
Add string format specifier %s for the printf calls in both
print_first_lines() and print_last_lines() thus resolving the warnings.
The test executes fine after this change thus causing no effect to the
functional behavior of the test.
Link: https://lkml.kernel.org/r/20250804225633.841777-1-hsukrut3@gmail.com
Fixes: aadc099c48 ("selftests/proc: add verbose mode for /proc/pid/maps tearing tests")
Signed-off-by: Sukrut Heroorkar <hsukrut3@gmail.com>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Cc: David Hunter <david.hunter.linux@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
aa5a10b070
commit
ab5ac789ef
|
|
@ -202,11 +202,11 @@ static void print_first_lines(char *text, int nr)
|
|||
int offs = end - text;
|
||||
|
||||
text[offs] = '\0';
|
||||
printf(text);
|
||||
printf("%s", text);
|
||||
text[offs] = '\n';
|
||||
printf("\n");
|
||||
} else {
|
||||
printf(text);
|
||||
printf("%s", text);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ static void print_last_lines(char *text, int nr)
|
|||
nr--;
|
||||
start--;
|
||||
}
|
||||
printf(start);
|
||||
printf("%s", start);
|
||||
}
|
||||
|
||||
static void print_boundaries(const char *title, FIXTURE_DATA(proc_maps_race) *self)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user