Commit 9acdb3bb authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Martin Schwidefsky

s390/monwriter: fix gcc 8 stringop-truncation warning

The following gcc warning is issued for strncpy which is used to
deliberately avoid string NUL-termination. Reuse memcpy to avoid the
warning.

    inlined from 'monwrite_diag' at drivers/s390/char/monwriter.c:64:2:
./include/linux/string.h:246:9: warning: '__builtin_strncpy' output
truncated before terminating nul copying 7 bytes from a string of the
same length [-Wstringop-truncation]
Reviewed-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 276d6050
...@@ -61,7 +61,7 @@ static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn) ...@@ -61,7 +61,7 @@ static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn)
struct appldata_product_id id; struct appldata_product_id id;
int rc; int rc;
strncpy(id.prod_nr, "LNXAPPL", 7); memcpy(id.prod_nr, "LNXAPPL", 7);
id.prod_fn = myhdr->applid; id.prod_fn = myhdr->applid;
id.record_nr = myhdr->record_num; id.record_nr = myhdr->record_num;
id.version_nr = myhdr->version; id.version_nr = myhdr->version;
......
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