Fix a possible overflow due to shift left. Also, replace the constant "9" with SECTOR_SHIFT. Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> --- block/blk-settings.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: linux-2.6/block/blk-settings.c =================================================================== --- linux-2.6.orig/block/blk-settings.c 2020-11-19 21:20:18.000000000 +0100 +++ linux-2.6/block/blk-settings.c 2020-11-20 10:50:15.000000000 +0100 @@ -151,8 +151,8 @@ void blk_queue_max_hw_sectors(struct req struct queue_limits *limits = &q->limits; unsigned int max_sectors; - if ((max_hw_sectors << 9) < PAGE_SIZE) { - max_hw_sectors = 1 << (PAGE_SHIFT - 9); + if (max_hw_sectors < 1 << (PAGE_SHIFT - SECTOR_SHIFT)) { + max_hw_sectors = 1 << (PAGE_SHIFT - SECTOR_SHIFT); printk(KERN_INFO "%s: set to minimum %d\n", __func__, max_hw_sectors); } @@ -161,7 +161,7 @@ void blk_queue_max_hw_sectors(struct req max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors); max_sectors = min_t(unsigned int, max_sectors, BLK_DEF_MAX_SECTORS); limits->max_sectors = max_sectors; - q->backing_dev_info->io_pages = max_sectors >> (PAGE_SHIFT - 9); + q->backing_dev_info->io_pages = max_sectors >> (PAGE_SHIFT - SECTOR_SHIFT); } EXPORT_SYMBOL(blk_queue_max_hw_sectors); -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel