aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorGerald Schaefer <gerald.schaefer@de.ibm.com>2013-10-14 09:51:31 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-24 11:17:08 -0400
commit3cf11d776aafdb8540f4ba2c57376d2089f77dba (patch)
tree6273d59bf1f6f7f9186a276731ee277627f13180 /drivers/s390
parent57f47ba0cb74303230a373d27238a0aaa0df3775 (diff)
s390/monwriter: fix smatch warning for strcpy()
This patch fixes the following smatch warning: monwrite_diag() error: strcpy() '"LNXAPPL"' too large for 'id.prod_nr' (8 vs 7) Using strcpy() is wrong, because it also copies the terminating null byte, but in this case the extra copied null byte will be overwritten right after the strcpy(), so there is no real problem here. Use strncpy() to fix the warning. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/monwriter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c
index 4600aa10a1c6..668b32b0dc1d 100644
--- a/drivers/s390/char/monwriter.c
+++ b/drivers/s390/char/monwriter.c
@@ -60,7 +60,7 @@ static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn)
60 struct appldata_product_id id; 60 struct appldata_product_id id;
61 int rc; 61 int rc;
62 62
63 strcpy(id.prod_nr, "LNXAPPL"); 63 strncpy(id.prod_nr, "LNXAPPL", 7);
64 id.prod_fn = myhdr->applid; 64 id.prod_fn = myhdr->applid;
65 id.record_nr = myhdr->record_num; 65 id.record_nr = myhdr->record_num;
66 id.version_nr = myhdr->version; 66 id.version_nr = myhdr->version;