diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-11-03 09:23:39 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-11-08 11:04:30 -0500 |
commit | f8c5e94486671ffcac696886c246baa6ba89b5cf (patch) | |
tree | 9a4cf461b240740a0670cc364aec7851b3907ae1 | |
parent | 6678d83f18386eb103f8345024e52c5abe61725c (diff) |
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>
-rw-r--r-- | include/linux/blktrace_api.h | 2 | ||||
-rw-r--r-- | kernel/trace/blktrace.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index a12f6ed91c84..afc1343df3c7 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -89,7 +89,7 @@ static inline int blk_trace_init_sysfs(struct device *dev) | |||
89 | #ifdef CONFIG_COMPAT | 89 | #ifdef CONFIG_COMPAT |
90 | 90 | ||
91 | struct compat_blk_user_trace_setup { | 91 | struct compat_blk_user_trace_setup { |
92 | char name[32]; | 92 | char name[BLKTRACE_BDEV_SIZE]; |
93 | u16 act_mask; | 93 | u16 act_mask; |
94 | u32 buf_size; | 94 | u32 buf_size; |
95 | u32 buf_nr; | 95 | u32 buf_nr; |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 7f727b34280d..f785aef65799 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -579,13 +579,12 @@ static int compat_blk_trace_setup(struct request_queue *q, char *name, | |||
579 | .end_lba = cbuts.end_lba, | 579 | .end_lba = cbuts.end_lba, |
580 | .pid = cbuts.pid, | 580 | .pid = cbuts.pid, |
581 | }; | 581 | }; |
582 | memcpy(&buts.name, &cbuts.name, 32); | ||
583 | 582 | ||
584 | ret = do_blk_trace_setup(q, name, dev, bdev, &buts); | 583 | ret = do_blk_trace_setup(q, name, dev, bdev, &buts); |
585 | if (ret) | 584 | if (ret) |
586 | return ret; | 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 | blk_trace_remove(q); | 588 | blk_trace_remove(q); |
590 | return -EFAULT; | 589 | return -EFAULT; |
591 | } | 590 | } |