For large values of the number of zones reported, the sector increment calculated with "blk_queue_zone_sectors(q) * n" can overflow the unsigned int type used. Fix this with a cast to sector_t type. Fixes: e76239a3748c ("block: add a report_zones method") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx> --- block/blk-zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 79ad269b545d..231b7e1b6d22 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -134,7 +134,7 @@ static int blk_report_zones(struct gendisk *disk, sector_t sector, return ret; if (!n) break; - sector += blk_queue_zone_sectors(q) * n; + sector += (sector_t)blk_queue_zone_sectors(q) * n; z += n; } -- 2.21.0