From 9acdb3bb070167c257252e131f56fb8daaa99766 Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Thu, 28 Jun 2018 13:16:14 +0200 Subject: [PATCH] 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: Gerald Schaefer Signed-off-by: Vasily Gorbik Signed-off-by: Martin Schwidefsky --- drivers/s390/char/monwriter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c index 76c158c41510..4f1a69c9d81d 100644 --- a/drivers/s390/char/monwriter.c +++ b/drivers/s390/char/monwriter.c @@ -61,7 +61,7 @@ static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn) struct appldata_product_id id; int rc; - strncpy(id.prod_nr, "LNXAPPL", 7); + memcpy(id.prod_nr, "LNXAPPL", 7); id.prod_fn = myhdr->applid; id.record_nr = myhdr->record_num; id.version_nr = myhdr->version;