s390: Remove optional third argument of strscpy() if possible
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 11 Apr 2025 13:29:12 +0000 (15:29 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 17 Apr 2025 13:16:10 +0000 (15:16 +0200)
The third argument of strscpy() is optional and can be left away iff
the destination is an array and the maximum size of the copy is the
size of destination.
Remove the third argument for those cases where this is possible.

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/cert_store.c
arch/s390/kernel/debug.c
arch/s390/kernel/ipl.c
drivers/s390/char/diag_ftp.c

index 03f3a1e524305a3026a442fe10c610922c88fc26..c217a5e640943da87e49ce257c4cd9420d48d185 100644 (file)
@@ -138,7 +138,7 @@ static void cert_store_key_describe(const struct key *key, struct seq_file *m)
         * First 64 bytes of the key description is key name in EBCDIC CP 500.
         * Convert it to ASCII for displaying in /proc/keys.
         */
-       strscpy(ascii, key->description, sizeof(ascii));
+       strscpy(ascii, key->description);
        EBCASC_500(ascii, VC_NAME_LEN_BYTES);
        seq_puts(m, ascii);
 
index ce038e9205f718ec9b831ce98d30373e9b4dd2ef..2a41be2f79251f61678d50bb32176775d955b616 100644 (file)
@@ -251,7 +251,7 @@ static debug_info_t *debug_info_alloc(const char *name, int pages_per_area,
        rc->level          = level;
        rc->buf_size       = buf_size;
        rc->entry_size     = sizeof(debug_entry_t) + buf_size;
-       strscpy(rc->name, name, sizeof(rc->name));
+       strscpy(rc->name, name);
        memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *));
        memset(rc->debugfs_entries, 0, DEBUG_MAX_VIEWS * sizeof(struct dentry *));
        refcount_set(&(rc->ref_count), 0);
index ef52d851f060acd08a7435edba755c3d0951a93f..ff15f91affdea4bf3d80f76b1c188ea491804e46 100644 (file)
@@ -270,7 +270,7 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj,        \
 {                                                                      \
        if (len >= sizeof(_value))                                      \
                return -E2BIG;                                          \
-       len = strscpy(_value, buf, sizeof(_value));                     \
+       len = strscpy(_value, buf);                                     \
        if ((ssize_t)len < 0)                                           \
                return len;                                             \
        strim(_value);                                                  \
index 711f6982438e97ab126d4e1bae612bacfbc79c86..f41b39c9d26798f4f6d8f6771240dfeb60116fc3 100644 (file)
@@ -159,7 +159,7 @@ ssize_t diag_ftp_cmd(const struct hmcdrv_ftp_cmdspec *ftp, size_t *fsize)
                goto out;
        }
 
-       len = strscpy(ldfpl->fident, ftp->fname, sizeof(ldfpl->fident));
+       len = strscpy(ldfpl->fident, ftp->fname);
        if (len < 0) {
                len = -EINVAL;
                goto out_free;