Skip to content

Commit

Permalink
s390/lcs: Convert sprintf to scnprintf
Browse files Browse the repository at this point in the history
This LWN article explains the why scnprintf is preferred over snprintf
in general
https://lwn.net/Articles/69419/
Ie. snprintf() returns what *would* be the resulting length, while
scnprintf() returns the actual length.

Reported-by: Jules Irenge <jbi.octave@gmail.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Thorsten Winkler <twinkler@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Thorsten Winkler authored and Paolo Abeni committed Jun 23, 2023
1 parent d3f0c7f commit 1a079f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/s390/net/lcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ do { \
#define LCS_DBF_TEXT_(level,name,text...) \
do { \
if (debug_level_enabled(lcs_dbf_##name, level)) { \
sprintf(debug_buffer, text); \
scnprintf(debug_buffer, sizeof(debug_buffer), text); \
debug_text_event(lcs_dbf_##name, level, debug_buffer); \
} \
} while (0)
Expand Down

0 comments on commit 1a079f3

Please sign in to comment.