aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdheer Chandravanshi <adheer.chandravanshi@qlogic.com>2013-04-17 05:15:28 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-05-02 15:27:33 -0400
commit1bcb56190353f12aa99e455658760d25b07e4646 (patch)
tree88952c1942db740ad61ac9fc804aeb96212d5588
parent28e02f1ad838fdf7eebea69c9fc752cd164910da (diff)
[SCSI] qla4xxx: Fix smatch warnings
Fix following smatch warnings:- drivers/scsi/qla4xxx/ql4_os.c:6573 qla4xxx_sysfs_ddb_set_param() warn: possible memory leak of 'fw_ddb_entry' drivers/scsi/qla4xxx/ql4_os.c:6596 qla4xxx_sysfs_ddb_delete() warn: variable dereferenced before check 'fnode_sess' (see line 6584) drivers/scsi/qla4xxx/ql4_os.c:6632 qla4xxx_sysfs_ddb_delete() error: potential NULL dereference 'fw_ddb_entry'. Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 3682fbd62d05..7f13caa8f502 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6366,20 +6366,11 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess,
6366{ 6366{
6367 struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_sess); 6367 struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_sess);
6368 struct scsi_qla_host *ha = to_qla_host(shost); 6368 struct scsi_qla_host *ha = to_qla_host(shost);
6369 struct dev_db_entry *fw_ddb_entry = NULL;
6370 struct iscsi_flashnode_param_info *fnode_param; 6369 struct iscsi_flashnode_param_info *fnode_param;
6371 struct nlattr *attr; 6370 struct nlattr *attr;
6372 int rc = QLA_ERROR; 6371 int rc = QLA_ERROR;
6373 uint32_t rem = len; 6372 uint32_t rem = len;
6374 6373
6375 fw_ddb_entry = kzalloc(sizeof(*fw_ddb_entry), GFP_KERNEL);
6376 if (!fw_ddb_entry) {
6377 DEBUG2(ql4_printk(KERN_ERR, ha,
6378 "%s: Unable to allocate ddb buffer\n",
6379 __func__));
6380 return -ENOMEM;
6381 }
6382
6383 nla_for_each_attr(attr, data, len, rem) { 6374 nla_for_each_attr(attr, data, len, rem) {
6384 fnode_param = nla_data(attr); 6375 fnode_param = nla_data(attr);
6385 6376
@@ -6593,11 +6584,6 @@ static int qla4xxx_sysfs_ddb_delete(struct iscsi_bus_flash_session *fnode_sess)
6593 int target_id; 6584 int target_id;
6594 int rc = 0; 6585 int rc = 0;
6595 6586
6596 if (!fnode_sess) {
6597 rc = -EINVAL;
6598 goto exit_ddb_del;
6599 }
6600
6601 if (fnode_sess->is_boot_target) { 6587 if (fnode_sess->is_boot_target) {
6602 rc = -EPERM; 6588 rc = -EPERM;
6603 DEBUG2(ql4_printk(KERN_ERR, ha, 6589 DEBUG2(ql4_printk(KERN_ERR, ha,
@@ -6629,8 +6615,7 @@ static int qla4xxx_sysfs_ddb_delete(struct iscsi_bus_flash_session *fnode_sess)
6629 6615
6630 dev_db_start_offset += (fnode_sess->target_id * 6616 dev_db_start_offset += (fnode_sess->target_id *
6631 sizeof(*fw_ddb_entry)); 6617 sizeof(*fw_ddb_entry));
6632 dev_db_start_offset += (void *)&(fw_ddb_entry->cookie) - 6618 dev_db_start_offset += offsetof(struct dev_db_entry, cookie);
6633 (void *)fw_ddb_entry;
6634 6619
6635 ddb_size = sizeof(*ddb_cookie); 6620 ddb_size = sizeof(*ddb_cookie);
6636 } 6621 }