Skip to content

Commit 63db5ac

Browse files
committed
Merge tag 'renesas-drivers-for-v5.15-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel into arm/drivers
Renesas driver updates for v5.15 (take two) - Prefer memcpy() over strcpy(). * tag 'renesas-drivers-for-v5.15-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel: soc: renesas: Prefer memcpy() over strcpy() Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents c4361de + 148bcca commit 63db5ac

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

drivers/soc/renesas/r8a779a0-sysc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,19 +404,21 @@ static int __init r8a779a0_sysc_pd_init(void)
404404
for (i = 0; i < info->num_areas; i++) {
405405
const struct r8a779a0_sysc_area *area = &info->areas[i];
406406
struct r8a779a0_sysc_pd *pd;
407+
size_t n;
407408

408409
if (!area->name) {
409410
/* Skip NULLified area */
410411
continue;
411412
}
412413

413-
pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL);
414+
n = strlen(area->name) + 1;
415+
pd = kzalloc(sizeof(*pd) + n, GFP_KERNEL);
414416
if (!pd) {
415417
error = -ENOMEM;
416418
goto out_put;
417419
}
418420

419-
strcpy(pd->name, area->name);
421+
memcpy(pd->name, area->name, n);
420422
pd->genpd.name = pd->name;
421423
pd->pdr = area->pdr;
422424
pd->flags = area->flags;

drivers/soc/renesas/rcar-sysc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,19 +396,21 @@ static int __init rcar_sysc_pd_init(void)
396396
for (i = 0; i < info->num_areas; i++) {
397397
const struct rcar_sysc_area *area = &info->areas[i];
398398
struct rcar_sysc_pd *pd;
399+
size_t n;
399400

400401
if (!area->name) {
401402
/* Skip NULLified area */
402403
continue;
403404
}
404405

405-
pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL);
406+
n = strlen(area->name) + 1;
407+
pd = kzalloc(sizeof(*pd) + n, GFP_KERNEL);
406408
if (!pd) {
407409
error = -ENOMEM;
408410
goto out_put;
409411
}
410412

411-
strcpy(pd->name, area->name);
413+
memcpy(pd->name, area->name, n);
412414
pd->genpd.name = pd->name;
413415
pd->ch.chan_offs = area->chan_offs;
414416
pd->ch.chan_bit = area->chan_bit;

0 commit comments

Comments
 (0)