Skip to contentSkip to conversation

scsi: be2iscsi: allocate enough memory in beiscsi_boot_get_sinfo()

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 18, 2016 – Nov 22, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: be2iscsi: allocate enough memory in beiscsi_boot_get_sinfo()

We accidentally allocate sizeof(u32) instead of sizeof(struct be_cmd_get_session_resp).

Fixes 50a4b824be9e ("scsi: be2iscsi: Fix to make boot discovery non-blocking")
drivers/scsi/be2iscsi/be_mgmt.c +1 -1
index aebc4dd..ac05317b 100644
@@ -1083,7 +1083,7 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba)
 	nonemb_cmd = &phba->boot_struct.nonemb_cmd;
 	nonemb_cmd->size = sizeof(*resp);
 	nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev,
-					      sizeof(nonemb_cmd->size),
+					      nonemb_cmd->size,
 					      &nonemb_cmd->dma);
 	if (!nonemb_cmd->va) {
 		mutex_unlock(&ctrl->mbox_lock);
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Friday, November 18, 2016 5:24 PM
To: Subbu Seetharaman; Jitendra Bhivare
Cc: Ketan Mukadam; James E.J. Bottomley; Martin K. Petersen; linux- [email protected]; [email protected]
Subject: [patch] scsi: be2iscsi: allocate enough memory in beiscsi_boot_get_sinfo()

Quoted 4 lines

We accidentally allocate sizeof(u32) instead of sizeof(struct be_cmd_get_session_resp).

Fixes 50a4b824be9e ("scsi: be2iscsi: Fix to make boot discovery

non-blocking")

Review

Quoted 3 lines
(quoted diff) +0 -0

b/drivers/scsi/be2iscsi/be_mgmt.c

Quoted 12 lines

index aebc4dd..ac05317b 100644

drivers/scsi/be2iscsi/be_mgmt.c +1 -1
@@ -1083,7 +1083,7 @@ unsigned int beiscsi_boot_get_sinfo(struct
 beiscsi_hba *phba)
 	nonemb_cmd = &phba->boot_struct.nonemb_cmd;
 	nonemb_cmd->size = sizeof(*resp);
 	nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev,
-					      sizeof(nonemb_cmd->size),
+					      nonemb_cmd->size,
 					      &nonemb_cmd->dma);
 	if (!nonemb_cmd->va) {
Quoted 1 line

mutex_unlock(&ctrl->mbox_lock);

Reviewed by: Jitendra Bhivare <[email protected]>

Thanks,

JB

#2 lore raw
In reply to Dan Carpenter
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dan" = Dan Carpenter <[email protected]> writes:

Dan> We accidentally allocate sizeof(u32) instead of sizeof(struct Dan> be_cmd_get_session_resp).

Applied to 4.9/scsi-fixes.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering