diff options
author | Alexander Gordeev <agordeev@linux.ibm.com> | 2023-07-11 17:41:37 +0200 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2023-07-24 12:12:23 +0200 |
commit | 3b53d7b131bd79d97dd553af84846fde456e029f (patch) | |
tree | 856dc9b20336b860573a27f76d3dd63f8c72354c /drivers/s390/block | |
parent | s390/dcssblk: use IS_ALIGNED() for alignment checks (diff) | |
download | linux-3b53d7b131bd79d97dd553af84846fde456e029f.tar.xz linux-3b53d7b131bd79d97dd553af84846fde456e029f.zip |
s390/dcssblk: fix virtual vs physical address confusion
Fix virtual vs physical address confusion (which currently are the same).
Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'drivers/s390/block')
-rw-r--r-- | drivers/s390/block/dcssblk.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 4f157dc1608e..6eafd0a34483 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -860,7 +860,7 @@ dcssblk_submit_bio(struct bio *bio) struct bio_vec bvec; struct bvec_iter iter; unsigned long index; - unsigned long page_addr; + void *page_addr; unsigned long source_addr; unsigned long bytes_done; @@ -889,19 +889,16 @@ dcssblk_submit_bio(struct bio *bio) index = (bio->bi_iter.bi_sector >> 3); bio_for_each_segment(bvec, bio, iter) { - page_addr = (unsigned long)bvec_virt(&bvec); + page_addr = bvec_virt(&bvec); source_addr = dev_info->start + (index<<12) + bytes_done; - if (unlikely(!IS_ALIGNED(page_addr, PAGE_SIZE) || + if (unlikely(!IS_ALIGNED((unsigned long)page_addr, PAGE_SIZE) || !IS_ALIGNED(bvec.bv_len, PAGE_SIZE))) // More paranoia. goto fail; - if (bio_data_dir(bio) == READ) { - memcpy((void*)page_addr, (void*)source_addr, - bvec.bv_len); - } else { - memcpy((void*)source_addr, (void*)page_addr, - bvec.bv_len); - } + if (bio_data_dir(bio) == READ) + memcpy(page_addr, __va(source_addr), bvec.bv_len); + else + memcpy(__va(source_addr), page_addr, bvec.bv_len); bytes_done += bvec.bv_len; } bio_endio(bio); |