qla4xxx: don't free NULL dma pool
Subsystems (3)
PATCH 1/1 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.
drivers/scsi/qla4xxx/ql4_mbx.c +2 -4
@@ -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);
-----Original Message-----
From: Dan Carpenter <[email protected]>
Date: Wednesday 30 January 2013 12:37 PM
To: Ravi Anand <[email protected]>
Cc: Vikas <[email protected]>, Dept-Eng iSCSI Driver <[email protected]>, "James E.J. Bottomley" <[email protected]>, scsi <[email protected]>, "[email protected]" <[email protected]>
Subject: [patch] [SCSI] qla4xxx: don't free NULL dma pool
Quoted 24 lines
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 <[email protected]>drivers/scsi/qla4xxx/ql4_mbx.c +2
-4@@ -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 );
Quoted 1 line
memset(chap_table, 0, chap_size);
Thanks for a fix.
________________________________
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.