diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 89d89c7162aa..6189bf26b53d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -844,7 +844,7 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, unsigned int cmd_flags) { if (unlikely(cmd_flags & REQ_DISCARD)) - return q->limits.max_discard_sectors; + return min(q->limits.max_discard_sectors, UINT_MAX >> 9); if (unlikely(cmd_flags & REQ_WRITE_SAME)) return q->limits.max_write_same_sectors;