Skip to content

Commit e37988b

Browse files
JustinStittVasily Gorbik
authored andcommitted
s390/sclp: replace deprecated strncpy with strtomem
Let's move away from using strncpy() as it is deprecated [1]. Instead use strtomem() as `e.id` is already marked as nonstring: | char id[4] __nonstring; We don't need strtomem_pad() because `e` is already memset to 0 -- rendering any additional NUL-padding useless. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: KSPP#90 Cc: [email protected] Signed-off-by: Justin Stitt <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/20231023-strncpy-drivers-s390-char-sclp-c-v1-1-eaeef80522bb@google.com Signed-off-by: Vasily Gorbik <[email protected]>
1 parent e78002a commit e37988b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/s390/char/sclp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static inline void sclp_trace(int prio, char *id, u32 a, u64 b, bool err)
8181
struct sclp_trace_entry e;
8282

8383
memset(&e, 0, sizeof(e));
84-
strncpy(e.id, id, sizeof(e.id));
84+
strtomem(e.id, id);
8585
e.a = a;
8686
e.b = b;
8787
debug_event(&sclp_debug, prio, &e, sizeof(e));

0 commit comments

Comments
 (0)