===================================================================
@@ -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);
Fix a possible overflow due to shift left. Also, replace the constant "9" with SECTOR_SHIFT. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> --- block/blk-settings.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)