* [patch] [SCSI] qla4xxx: don't free NULL dma pool
@ 2013-01-30 7:07 Dan Carpenter
2013-01-30 12:41 ` Vikas Chaudhary
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-01-30 7:07 UTC (permalink / raw)
To: Ravi Anand
Cc: Vikas Chaudhary, iscsi-driver, James E.J. Bottomley, linux-scsi,
kernel-janitors
The error path calls dma_pool_free() on this path but "chap_table" is
NULL and "chap_dma" is uninitialized. It's cleaner to just return
directly.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 1c57c22..887e409 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1404,10 +1404,8 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username, char *password,
dma_addr_t chap_dma;
chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
- if (chap_table == NULL) {
- ret = -ENOMEM;
- goto exit_get_chap;
- }
+ if (chap_table == NULL)
+ return -ENOMEM;
chap_size = sizeof(struct ql4_chap_table);
memset(chap_table, 0, chap_size);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] [SCSI] qla4xxx: don't free NULL dma pool
2013-01-30 7:07 [patch] [SCSI] qla4xxx: don't free NULL dma pool Dan Carpenter
@ 2013-01-30 12:41 ` Vikas Chaudhary
0 siblings, 0 replies; 2+ messages in thread
From: Vikas Chaudhary @ 2013-01-30 12:41 UTC (permalink / raw)
To: Dan Carpenter, Ravi Anand
Cc: Dept-Eng iSCSI Driver, James E.J. Bottomley,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
-----Original Message-----
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wednesday 30 January 2013 12:37 PM
To: Ravi Anand <ravi.anand@qlogic.com>
Cc: Vikas <vikas.chaudhary@qlogic.com>, Dept-Eng iSCSI Driver
<Dept-iSCSIDriver@qlogic.com>, "James E.J. Bottomley"
<JBottomley@parallels.com>, scsi <linux-scsi@vger.kernel.org>,
"kernel-janitors@vger.kernel.org" <kernel-janitors@vger.kernel.org>
Subject: [patch] [SCSI] qla4xxx: don't free NULL dma pool
>The error path calls dma_pool_free() on this path but "chap_table" is
>NULL and "chap_dma" is uninitialized. It's cleaner to just return
>directly.
>
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c
>b/drivers/scsi/qla4xxx/ql4_mbx.c
>index 1c57c22..887e409 100644
>--- a/drivers/scsi/qla4xxx/ql4_mbx.c
>+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
>@@ -1404,10 +1404,8 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha,
>char *username, char *password,
> dma_addr_t chap_dma;
>
> chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
>- if (chap_table == NULL) {
>- ret = -ENOMEM;
>- goto exit_get_chap;
>- }
>+ if (chap_table == NULL)
>+ return -ENOMEM;
>
> chap_size = sizeof(struct ql4_chap_table);
> memset(chap_table, 0, chap_size);
Thanks for a fix.
Acked-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
________________________________
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-30 12:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30 7:07 [patch] [SCSI] qla4xxx: don't free NULL dma pool Dan Carpenter
2013-01-30 12:41 ` Vikas Chaudhary
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox