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

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