Merge tag 'drivers-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / drivers / soc / renesas / rcar-sysc.c
index 53387a7..b0a80de 100644 (file)
@@ -396,19 +396,21 @@ static int __init rcar_sysc_pd_init(void)
        for (i = 0; i < info->num_areas; i++) {
                const struct rcar_sysc_area *area = &info->areas[i];
                struct rcar_sysc_pd *pd;
+               size_t n;
 
                if (!area->name) {
                        /* Skip NULLified area */
                        continue;
                }
 
-               pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL);
+               n = strlen(area->name) + 1;
+               pd = kzalloc(sizeof(*pd) + n, GFP_KERNEL);
                if (!pd) {
                        error = -ENOMEM;
                        goto out_put;
                }
 
-               strcpy(pd->name, area->name);
+               memcpy(pd->name, area->name, n);
                pd->genpd.name = pd->name;
                pd->ch.chan_offs = area->chan_offs;
                pd->ch.chan_bit = area->chan_bit;