]> git.itanic.dy.fi Git - linux-stable/commitdiff
s390/hmcdrv: use strscpy() instead of strlcpy()
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 31 Jan 2023 18:50:25 +0000 (19:50 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 6 Feb 2023 10:13:53 +0000 (11:13 +0100)
Given that strlcpy() is deprecated use strscpy() instead.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/char/diag_ftp.c
drivers/s390/char/sclp_ftp.c

index 36bbd6b6e2108d6c89c01f4c76b2fe3f6d601607..65c7f2d565d80631444c3a9cfd6cfd4441c5ed0e 100644 (file)
@@ -159,8 +159,8 @@ ssize_t diag_ftp_cmd(const struct hmcdrv_ftp_cmdspec *ftp, size_t *fsize)
                goto out;
        }
 
-       len = strlcpy(ldfpl->fident, ftp->fname, sizeof(ldfpl->fident));
-       if (len >= HMCDRV_FTP_FIDENT_MAX) {
+       len = strscpy(ldfpl->fident, ftp->fname, sizeof(ldfpl->fident));
+       if (len < 0) {
                len = -EINVAL;
                goto out_free;
        }
index ec5a0e2b9255461c9e86dd4482f2c8cdda7876d0..d27e2cbfbccb38ebb681112e4127880a4173bf49 100644 (file)
@@ -90,7 +90,7 @@ static int sclp_ftp_et7(const struct hmcdrv_ftp_cmdspec *ftp)
        struct completion completion;
        struct sclp_diag_sccb *sccb;
        struct sclp_req *req;
-       size_t len;
+       ssize_t len;
        int rc;
 
        req = kzalloc(sizeof(*req), GFP_KERNEL);
@@ -117,9 +117,9 @@ static int sclp_ftp_et7(const struct hmcdrv_ftp_cmdspec *ftp)
        sccb->evbuf.mdd.ftp.length = ftp->len;
        sccb->evbuf.mdd.ftp.bufaddr = virt_to_phys(ftp->buf);
 
-       len = strlcpy(sccb->evbuf.mdd.ftp.fident, ftp->fname,
+       len = strscpy(sccb->evbuf.mdd.ftp.fident, ftp->fname,
                      HMCDRV_FTP_FIDENT_MAX);
-       if (len >= HMCDRV_FTP_FIDENT_MAX) {
+       if (len < 0) {
                rc = -EINVAL;
                goto out_free;
        }