diff mbox

scsi: be2iscsi: allocate enough memory in beiscsi_boot_get_sinfo()

Message ID 20161118115339.GD3281@mwanda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Dan Carpenter Nov. 18, 2016, 11:53 a.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jitendra Bhivare Nov. 21, 2016, 4:02 a.m. UTC | #1
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Friday, November 18, 2016 5:24 PM
> To: Subbu Seetharaman; Jitendra Bhivare
> Cc: Ketan Mukadam; James E.J. Bottomley; Martin K. Petersen; linux-
> scsi@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [patch] 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c
b/drivers/scsi/be2iscsi/be_mgmt.c
> index aebc4dd..ac05317b 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -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);

Reviewed by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>

Thanks,

JB
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen Nov. 22, 2016, 3:33 a.m. UTC | #2
>>>>> "Dan" == Dan Carpenter <dan.carpenter@oracle.com> writes:

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

Applied to 4.9/scsi-fixes.
diff mbox

Patch

diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index aebc4dd..ac05317b 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -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);