diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-09-15 07:08:27 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-15 07:08:27 -0400 |
commit | 144177991ca624841ddbd1e7edff958fc0f6d1fe (patch) | |
tree | 793a42427d46585c0acfcfe97d23e604174a2c10 /block/blk-map.c | |
parent | 8dcbdc742fec9e6c542ff9cb599d2ee620753d07 (diff) |
block: fix an address space warning in blk-map.c
Change type of 2nd parameter of blk_rq_aligned() into unsigned long
and remove unnecessary casting. Now we can call it with 'uaddr'
instead of 'ubuf' in __blk_rq_map_user() so that it can remove
following warnings from sparse:
block/blk-map.c:57:31: warning: incorrect type in argument 2 (different address spaces)
block/blk-map.c:57:31: expected void *addr
block/blk-map.c:57:31: got void [noderef] <asn:1>*ubuf
However blk_rq_map_kern() needs one more local variable to handle it.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-map.c')
-rw-r--r-- | block/blk-map.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/blk-map.c b/block/blk-map.c index c65d7593f7f1..ac0f7d46db63 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -54,7 +54,7 @@ static int __blk_rq_map_user(struct request_queue *q, struct request *rq, | |||
54 | * direct dma. else, set up kernel bounce buffers | 54 | * direct dma. else, set up kernel bounce buffers |
55 | */ | 55 | */ |
56 | uaddr = (unsigned long) ubuf; | 56 | uaddr = (unsigned long) ubuf; |
57 | if (blk_rq_aligned(q, ubuf, len) && !map_data) | 57 | if (blk_rq_aligned(q, uaddr, len) && !map_data) |
58 | bio = bio_map_user(q, NULL, uaddr, len, reading, gfp_mask); | 58 | bio = bio_map_user(q, NULL, uaddr, len, reading, gfp_mask); |
59 | else | 59 | else |
60 | bio = bio_copy_user(q, map_data, uaddr, len, reading, gfp_mask); | 60 | bio = bio_copy_user(q, map_data, uaddr, len, reading, gfp_mask); |
@@ -288,6 +288,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf, | |||
288 | unsigned int len, gfp_t gfp_mask) | 288 | unsigned int len, gfp_t gfp_mask) |
289 | { | 289 | { |
290 | int reading = rq_data_dir(rq) == READ; | 290 | int reading = rq_data_dir(rq) == READ; |
291 | unsigned long addr = (unsigned long) kbuf; | ||
291 | int do_copy = 0; | 292 | int do_copy = 0; |
292 | struct bio *bio; | 293 | struct bio *bio; |
293 | int ret; | 294 | int ret; |
@@ -297,7 +298,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf, | |||
297 | if (!len || !kbuf) | 298 | if (!len || !kbuf) |
298 | return -EINVAL; | 299 | return -EINVAL; |
299 | 300 | ||
300 | do_copy = !blk_rq_aligned(q, kbuf, len) || object_is_on_stack(kbuf); | 301 | do_copy = !blk_rq_aligned(q, addr, len) || object_is_on_stack(kbuf); |
301 | if (do_copy) | 302 | if (do_copy) |
302 | bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading); | 303 | bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading); |
303 | else | 304 | else |