File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -404,19 +404,21 @@ static int __init r8a779a0_sysc_pd_init(void)
404
404
for (i = 0 ; i < info -> num_areas ; i ++ ) {
405
405
const struct r8a779a0_sysc_area * area = & info -> areas [i ];
406
406
struct r8a779a0_sysc_pd * pd ;
407
+ size_t n ;
407
408
408
409
if (!area -> name ) {
409
410
/* Skip NULLified area */
410
411
continue ;
411
412
}
412
413
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 );
414
416
if (!pd ) {
415
417
error = - ENOMEM ;
416
418
goto out_put ;
417
419
}
418
420
419
- strcpy (pd -> name , area -> name );
421
+ memcpy (pd -> name , area -> name , n );
420
422
pd -> genpd .name = pd -> name ;
421
423
pd -> pdr = area -> pdr ;
422
424
pd -> flags = area -> flags ;
Original file line number Diff line number Diff line change @@ -396,19 +396,21 @@ static int __init rcar_sysc_pd_init(void)
396
396
for (i = 0 ; i < info -> num_areas ; i ++ ) {
397
397
const struct rcar_sysc_area * area = & info -> areas [i ];
398
398
struct rcar_sysc_pd * pd ;
399
+ size_t n ;
399
400
400
401
if (!area -> name ) {
401
402
/* Skip NULLified area */
402
403
continue ;
403
404
}
404
405
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 );
406
408
if (!pd ) {
407
409
error = - ENOMEM ;
408
410
goto out_put ;
409
411
}
410
412
411
- strcpy (pd -> name , area -> name );
413
+ memcpy (pd -> name , area -> name , n );
412
414
pd -> genpd .name = pd -> name ;
413
415
pd -> ch .chan_offs = area -> chan_offs ;
414
416
pd -> ch .chan_bit = area -> chan_bit ;
You can’t perform that action at this time.
0 commit comments