s390/hmcdrv: use strscpy() instead of strlcpy()

Given that strlcpy() is deprecated use strscpy() instead.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
Heiko Carstens 2023-01-31 19:50:25 +01:00
parent 6bb361d5d8
commit 03d4907396
2 changed files with 5 additions and 5 deletions

View 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;
}

View 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;
}