diff options
author | Alexander Gordeev <agordeev@linux.ibm.com> | 2023-07-11 17:59:42 +0200 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2023-07-24 12:12:23 +0200 |
commit | 04b8698ae879b88f96c083292f328bd31b555422 (patch) | |
tree | dfe1491996dc07e95bf3685eac556f2d54f70fe1 /drivers/s390/block/dcssblk.c | |
parent | s390/kexec: make machine_kexec() depend on CONFIG_KEXEC_CORE (diff) | |
download | linux-04b8698ae879b88f96c083292f328bd31b555422.tar.xz linux-04b8698ae879b88f96c083292f328bd31b555422.zip |
s390/dcssblk: use IS_ALIGNED() for alignment checks
Use IS_ALIGNED() instead of cumbersome bit manipulations.
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/dcssblk.c')
-rw-r--r-- | drivers/s390/block/dcssblk.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 09acf3853a77..4f157dc1608e 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -868,8 +868,8 @@ dcssblk_submit_bio(struct bio *bio) dev_info = bio->bi_bdev->bd_disk->private_data; if (dev_info == NULL) goto fail; - if ((bio->bi_iter.bi_sector & 7) != 0 || - (bio->bi_iter.bi_size & 4095) != 0) + if (!IS_ALIGNED(bio->bi_iter.bi_sector, 8) || + !IS_ALIGNED(bio->bi_iter.bi_size, PAGE_SIZE)) /* Request is not page-aligned. */ goto fail; /* verify data transfer direction */ @@ -891,7 +891,8 @@ dcssblk_submit_bio(struct bio *bio) bio_for_each_segment(bvec, bio, iter) { page_addr = (unsigned long)bvec_virt(&bvec); source_addr = dev_info->start + (index<<12) + bytes_done; - if (unlikely((page_addr & 4095) != 0) || (bvec.bv_len & 4095) != 0) + if (unlikely(!IS_ALIGNED(page_addr, PAGE_SIZE) || + !IS_ALIGNED(bvec.bv_len, PAGE_SIZE))) // More paranoia. goto fail; if (bio_data_dir(bio) == READ) { |