]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
megaraid_sas: Do not use PAGE_SIZE for max_sectors
authorsumit.saxena@avagotech.com <sumit.saxena@avagotech.com>
Thu, 15 Oct 2015 08:10:04 +0000 (13:40 +0530)
committerZefan Li <lizefan@huawei.com>
Wed, 26 Oct 2016 15:15:26 +0000 (23:15 +0800)
commit 357ae967ad66e357f78b5cfb5ab6ca07fb4a7758 upstream.

Do not use PAGE_SIZE marco to calculate max_sectors per I/O
request. Driver code assumes PAGE_SIZE will be always 4096 which can
lead to wrongly calculated value if PAGE_SIZE is not 4096. This issue
was reported in Ubuntu Bugzilla Bug #1475166.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_base.c

index 1a7955a39070ae8e077cd11a7cd9c12d256e4315..0eaf19676157edeb4d34bcaac1dcd409dfe58b9e 100644 (file)
@@ -300,6 +300,8 @@ enum MR_EVT_ARGS {
        MR_EVT_ARGS_GENERIC,
 };
 
+
+#define SGE_BUFFER_SIZE        4096
 /*
  * define constants for device list query options
  */
index bacd344f4626d19da76eee51acc2e93fe2a8e30a..a74dc7472e0640d8fe1912bc6a91e9193bb877af 100644 (file)
@@ -3582,7 +3582,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
        }
 
        instance->max_sectors_per_req = instance->max_num_sge *
-                                               PAGE_SIZE / 512;
+                                               SGE_BUFFER_SIZE / 512;
        if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors))
                instance->max_sectors_per_req = tmp_sectors;