Blame SOURCES/0107-scsi-scsi-qla2xxx-Replace-vmalloc-memset-with-vzallo.patch

3c6e85
From 0a9e3bccfbfbf1efcdce1fbdad1231ef93b03541 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:56:07 -0400
3c6e85
Subject: [PATCH 107/124] [scsi] scsi: qla2xxx: Replace vmalloc + memset with
3c6e85
 vzalloc
3c6e85
3c6e85
Message-id: <20190801155618.12650-108-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267880
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 107/118] scsi: qla2xxx: Replace vmalloc + memset with vzalloc
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Chuhong Yuan <hslester96@gmail.com>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
Use vzalloc instead of using vmalloc to allocate memory and then zeroing it
3c6e85
with memset.  This simplifies the code.
3c6e85
3c6e85
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
3c6e85
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit 56cc8fae5f7e9f38cb367754c52491ba1645d1bf)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_attr.c | 6 ++----
3c6e85
 1 file changed, 2 insertions(+), 4 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
index c7075f0a5019..a1fbf1af9ea0 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
@@ -382,7 +382,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		ha->optrom_region_size = size;
3c6e85
 
3c6e85
 		ha->optrom_state = QLA_SREADING;
3c6e85
-		ha->optrom_buffer = vmalloc(ha->optrom_region_size);
3c6e85
+		ha->optrom_buffer = vzalloc(ha->optrom_region_size);
3c6e85
 		if (ha->optrom_buffer == NULL) {
3c6e85
 			ql_log(ql_log_warn, vha, 0x7062,
3c6e85
 			    "Unable to allocate memory for optrom retrieval "
3c6e85
@@ -404,7 +404,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		    "Reading flash region -- 0x%x/0x%x.\n",
3c6e85
 		    ha->optrom_region_start, ha->optrom_region_size);
3c6e85
 
3c6e85
-		memset(ha->optrom_buffer, 0, ha->optrom_region_size);
3c6e85
 		ha->isp_ops->read_optrom(vha, ha->optrom_buffer,
3c6e85
 		    ha->optrom_region_start, ha->optrom_region_size);
3c6e85
 		break;
3c6e85
@@ -457,7 +456,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		ha->optrom_region_size = size;
3c6e85
 
3c6e85
 		ha->optrom_state = QLA_SWRITING;
3c6e85
-		ha->optrom_buffer = vmalloc(ha->optrom_region_size);
3c6e85
+		ha->optrom_buffer = vzalloc(ha->optrom_region_size);
3c6e85
 		if (ha->optrom_buffer == NULL) {
3c6e85
 			ql_log(ql_log_warn, vha, 0x7066,
3c6e85
 			    "Unable to allocate memory for optrom update "
3c6e85
@@ -472,7 +471,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		    "Staging flash region write -- 0x%x/0x%x.\n",
3c6e85
 		    ha->optrom_region_start, ha->optrom_region_size);
3c6e85
 
3c6e85
-		memset(ha->optrom_buffer, 0, ha->optrom_region_size);
3c6e85
 		break;
3c6e85
 	case 3:
3c6e85
 		if (ha->optrom_state != QLA_SWRITING) {
3c6e85
-- 
3c6e85
2.13.6
3c6e85