btrfs: fix bio_size_ok() for max_sectors > 0xffff

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:04 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=475bf36ffba2ad18631865a2429468dc6c7ea919
Commit:     475bf36ffba2ad18631865a2429468dc6c7ea919
Parent:     4cd8587ce8fb79e49d1d6d1fc065f056188fb86a
Author:     Akinobu Mita <akinobu.mita at gmail.com>
AuthorDate: Mon Nov 18 22:13:18 2013 +0900
Committer:  Chris Mason <chris.mason at fusionio.com>
CommitDate: Wed Nov 20 20:48:44 2013 -0500

    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 <chris.mason at fusionio.com>
    Cc: linux-btrfs at vger.kernel.org
    Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
    Signed-off-by: Chris Mason <chris.mason at fusionio.com>
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 0db6370..92303f4 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,



More information about the linux-mtd-cvs mailing list