Commit 80b7e928 authored by Wolfram Sang's avatar Wolfram Sang Committed by Miquel Raynal

mtd: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220818210033.7084-1-wsa+renesas@sang-engineering.com
parent bf3e6b8f
...@@ -461,7 +461,7 @@ static int block2mtd_setup(const char *val, const struct kernel_param *kp) ...@@ -461,7 +461,7 @@ static int block2mtd_setup(const char *val, const struct kernel_param *kp)
the device (even kmalloc() fails). Deter that work to the device (even kmalloc() fails). Deter that work to
block2mtd_setup2(). */ block2mtd_setup2(). */
strlcpy(block2mtd_paramline, val, sizeof(block2mtd_paramline)); strscpy(block2mtd_paramline, val, sizeof(block2mtd_paramline));
return 0; return 0;
#endif #endif
......
...@@ -193,7 +193,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -193,7 +193,7 @@ static struct mtd_partition * newpart(char *s,
parts[this_part].mask_flags = mask_flags; parts[this_part].mask_flags = mask_flags;
parts[this_part].add_flags = add_flags; parts[this_part].add_flags = add_flags;
if (name) if (name)
strlcpy(extra_mem, name, name_len + 1); strscpy(extra_mem, name, name_len + 1);
else else
sprintf(extra_mem, "Partition_%03d", this_part); sprintf(extra_mem, "Partition_%03d", this_part);
parts[this_part].name = extra_mem; parts[this_part].name = extra_mem;
...@@ -298,7 +298,7 @@ static int mtdpart_setup_real(char *s) ...@@ -298,7 +298,7 @@ static int mtdpart_setup_real(char *s)
this_mtd->parts = parts; this_mtd->parts = parts;
this_mtd->num_parts = num_parts; this_mtd->num_parts = num_parts;
this_mtd->mtd_id = (char*)(this_mtd + 1); this_mtd->mtd_id = (char*)(this_mtd + 1);
strlcpy(this_mtd->mtd_id, mtd_id, mtd_id_len + 1); strscpy(this_mtd->mtd_id, mtd_id, mtd_id_len + 1);
/* link into chain */ /* link into chain */
this_mtd->next = partitions; this_mtd->next = partitions;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment