diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-05-12 17:02:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-13 11:02:26 -0400 |
commit | f36f21ecca9ee688301174e5f2e0827827a7a7ff (patch) | |
tree | b147bb5cc37683dfe01c86fba634808aa2ff567d /block | |
parent | 78bb6cb9a890d3d50ca3b02fce9223d3e734ab9b (diff) |
Fix misuses of bdevname()
bdevname() fills the buffer that it is given as a parameter, so calling
strcpy() or snprintf() on the returned value is redundant (and probably not
guaranteed to work - I don't think strcpy and snprintf support overlapping
buffers.)
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/blktrace.c | 2 | ||||
-rw-r--r-- | block/compat_ioctl.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/block/blktrace.c b/block/blktrace.c index 568588cd16b2..b2cbb4e5d767 100644 --- a/block/blktrace.c +++ b/block/blktrace.c | |||
@@ -476,7 +476,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) | |||
476 | 476 | ||
477 | switch (cmd) { | 477 | switch (cmd) { |
478 | case BLKTRACESETUP: | 478 | case BLKTRACESETUP: |
479 | strcpy(b, bdevname(bdev, b)); | 479 | bdevname(bdev, b); |
480 | ret = blk_trace_setup(q, b, bdev->bd_dev, arg); | 480 | ret = blk_trace_setup(q, b, bdev->bd_dev, arg); |
481 | break; | 481 | break; |
482 | case BLKTRACESTART: | 482 | case BLKTRACESTART: |
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index c70d0b6f666f..c23177e4623f 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
@@ -555,7 +555,7 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg) | |||
555 | if (copy_from_user(&cbuts, arg, sizeof(cbuts))) | 555 | if (copy_from_user(&cbuts, arg, sizeof(cbuts))) |
556 | return -EFAULT; | 556 | return -EFAULT; |
557 | 557 | ||
558 | strcpy(b, bdevname(bdev, b)); | 558 | bdevname(bdev, b); |
559 | 559 | ||
560 | buts = (struct blk_user_trace_setup) { | 560 | buts = (struct blk_user_trace_setup) { |
561 | .act_mask = cbuts.act_mask, | 561 | .act_mask = cbuts.act_mask, |