From: Akinobu Mita Date: Mon, 18 Nov 2013 13:13:18 +0000 (+0900) Subject: btrfs: fix bio_size_ok() for max_sectors > 0xffff X-Git-Tag: firefly_0821_release~176^2~4789^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=475bf36ffba2ad18631865a2429468dc6c7ea919;p=firefly-linux-kernel-4.4.55.git btrfs: fix bio_size_ok() for max_sectors > 0xffff The data type of max_sectors in queue settings is unsigned int. But this value is stored to the local variable whose type is unsigned short in bio_size_ok(). This can cause unexpected result when max_sectors > 0xffff. Cc: Chris Mason Cc: linux-btrfs@vger.kernel.org Signed-off-by: Akinobu Mita Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0db637097862..92303f42baaa 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5394,7 +5394,7 @@ static int bio_size_ok(struct block_device *bdev, struct bio *bio, { struct bio_vec *prev; struct request_queue *q = bdev_get_queue(bdev); - unsigned short max_sectors = queue_max_sectors(q); + unsigned int max_sectors = queue_max_sectors(q); struct bvec_merge_data bvm = { .bi_bdev = bdev, .bi_sector = sector,