Commit f8c5e94486671ffcac696886c246baa6ba89b5cf
Committed by
Jens Axboe
1 parent
6678d83f18
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
kernel: trace: blktrace: remove redundent memcpy() in compat_blk_trace_setup()
do_blk_trace_setup() will fully initialize 'buts.name', so can remove the related memcpy(). And also use BLKTRACE_BDEV_SIZE and ARRAY_SIZE instead of hard code number '32'. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Showing 2 changed files with 2 additions and 3 deletions Side-by-side Diff
include/linux/blktrace_api.h
kernel/trace/blktrace.c
... | ... | @@ -579,13 +579,12 @@ |
579 | 579 | .end_lba = cbuts.end_lba, |
580 | 580 | .pid = cbuts.pid, |
581 | 581 | }; |
582 | - memcpy(&buts.name, &cbuts.name, 32); | |
583 | 582 | |
584 | 583 | ret = do_blk_trace_setup(q, name, dev, bdev, &buts); |
585 | 584 | if (ret) |
586 | 585 | return ret; |
587 | 586 | |
588 | - if (copy_to_user(arg, &buts.name, 32)) { | |
587 | + if (copy_to_user(arg, &buts.name, ARRAY_SIZE(buts.name))) { | |
589 | 588 | blk_trace_remove(q); |
590 | 589 | return -EFAULT; |
591 | 590 | } |