[Gluster-devel] Fwd: New Defects reported by Coverity Scan for GlusterFS

Lalatendu Mohanty lmohanty at redhat.com
Mon Jun 16 08:43:43 UTC 2014


FYI,

To fix these Coverity issues , please check the below link for how to 
and guidelines:

http://www.gluster.org/community/documentation/index.php/Fixing_Issues_Reported_By_Tools_For_Static_Code_Analysis#Coverity

Thanks,
Lala


-------- Original Message --------
Subject: 	New Defects reported by Coverity Scan for GlusterFS
Date: 	Sun, 15 Jun 2014 23:52:47 -0700
From: 	scan-admin at coverity.com



Hi,


Please find the latest report on new defect(s) introduced to GlusterFS found with Coverity Scan.

Defect(s) Reported-by: Coverity Scan
Showing 8 of 8 defect(s)


** CID 1223039:  Dereference after null check  (FORWARD_NULL)
/xlators/features/changelog/src/changelog.c: 2057 in init()

** CID 1223041:  Data race condition  (MISSING_LOCK)
/xlators/features/snapview-server/src/snapview-server.c: 2768 in init()

** CID 1223040:  Data race condition  (MISSING_LOCK)
/xlators/features/snapview-server/src/snapview-server.c: 2770 in init()

** CID 1223046:  Resource leak  (RESOURCE_LEAK)
/xlators/features/snapview-server/src/snapview-server.c: 378 in mgmt_get_snapinfo_cbk()

** CID 1223045:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 3826 in glusterd_update_fstype()

** CID 1223044:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 5503 in glusterd_snapshot_config_commit()

** CID 1223043:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 1497 in _get_slave_status()

** CID 1223042:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 1035 in _get_status_mst_slv()


________________________________________________________________________________________________________
*** CID 1223039:  Dereference after null check  (FORWARD_NULL)
/xlators/features/changelog/src/changelog.c: 2057 in init()
2051                             GF_FREE (priv->changelog_brick);
2052                             GF_FREE (priv->changelog_dir);
2053                             if (cond_lock_init)
2054                                     changelog_pthread_destroy (priv);
2055                             GF_FREE (priv);
2056                     }
>>>     CID 1223039:  Dereference after null check  (FORWARD_NULL)
>>>     Dereferencing null pointer "this".
2057                     this->private = NULL;
2058             } else
2059                     this->private = priv;
2060
2061             return ret;
2062     }

________________________________________________________________________________________________________
*** CID 1223041:  Data race condition  (MISSING_LOCK)
/xlators/features/snapview-server/src/snapview-server.c: 2768 in init()
2762                     goto out;
2763
2764             this->private = priv;
2765
2766             GF_OPTION_INIT ("volname", priv->volname, str, out);
2767             pthread_mutex_init (&(priv->snaplist_lock), NULL);
>>>     CID 1223041:  Data race condition  (MISSING_LOCK)
>>>     Accessing "priv->is_snaplist_done" without holding lock "svs_private.snaplist_lock". Elsewhere, "priv->is_snaplist_done" is accessed with "svs_private.snaplist_lock" held 2 out of 2 times.
2768             priv->is_snaplist_done = 0;
2769             priv->num_snaps = 0;
2770             snap_worker_resume = _gf_false;
2771
2772             /* get the list of snaps first to return to client xlator */
2773             ret = svs_get_snapshot_list (this);

________________________________________________________________________________________________________
*** CID 1223040:  Data race condition  (MISSING_LOCK)
/xlators/features/snapview-server/src/snapview-server.c: 2770 in init()
2764             this->private = priv;
2765
2766             GF_OPTION_INIT ("volname", priv->volname, str, out);
2767             pthread_mutex_init (&(priv->snaplist_lock), NULL);
2768             priv->is_snaplist_done = 0;
2769             priv->num_snaps = 0;
>>>     CID 1223040:  Data race condition  (MISSING_LOCK)
>>>     Accessing "snap_worker_resume" without holding lock "mutex". Elsewhere, "snap_worker_resume" is accessed with "mutex" held 3 out of 3 times.
2770             snap_worker_resume = _gf_false;
2771
2772             /* get the list of snaps first to return to client xlator */
2773             ret = svs_get_snapshot_list (this);
2774             if (ret) {
2775                     gf_log (this->name, GF_LOG_ERROR,

________________________________________________________________________________________________________
*** CID 1223046:  Resource leak  (RESOURCE_LEAK)
/xlators/features/snapview-server/src/snapview-server.c: 378 in mgmt_get_snapinfo_cbk()
372             free (rsp.op_errstr);
373
374             if (myframe)
375                     SVS_STACK_DESTROY (myframe);
376
377     error_out:
>>>     CID 1223046:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "dirents" going out of scope leaks the storage it points to.
378             return ret;
379     }
380
381     int
382     svs_get_snapshot_list (xlator_t *this)
383     {

________________________________________________________________________________________________________
*** CID 1223045:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 3826 in glusterd_update_fstype()
3820             /* Update the file-system type for snap brickinfo */
3821             snprintf (snap_brickinfo->fstype, sizeof (snap_brickinfo->fstype),
3822                       "%s", fstype);
3823
3824             ret = 0;
3825     out:
>>>     CID 1223045:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "mnt_pt" going out of scope leaks the storage it points to.
3826             return ret;
3827     }
3828
3829     static int32_t
3830     glusterd_add_brick_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
3831                                         glusterd_volinfo_t  *snap_vol,

________________________________________________________________________________________________________
*** CID 1223044:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 5503 in glusterd_snapshot_config_commit()
5497             default:
5498                     break;
5499             }
5500
5501     out:
5502             gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
>>>     CID 1223044:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "next_version" going out of scope leaks the storage it points to.
5503             return ret;
5504     }
5505
5506     int
5507     glusterd_get_brick_lvm_details (dict_t *rsp_dict,
5508                                    glusterd_brickinfo_t *brickinfo, char *volname,

________________________________________________________________________________________________________
*** CID 1223043:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 1497 in _get_slave_status()
1491             conf_path[ret] = '\0';
1492
1493             ret = is_geo_rep_active (param->volinfo,slave, conf_path,
1494                                      &param->is_active);
1495     out:
1496             GF_FREE(errmsg);
>>>     CID 1223043:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "slave_url" going out of scope leaks the storage it points to.
1497             return ret;
1498     }
1499
1500     static int
1501     glusterd_op_verify_gsync_running (glusterd_volinfo_t *volinfo,
1502                                       char *slave, char *conf_path,

________________________________________________________________________________________________________
*** CID 1223042:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 1035 in _get_status_mst_slv()
1029             GF_FREE (errmsg);
1030
1031             if (slave_buf)
1032                     GF_FREE(slave_buf);
1033
1034             gf_log ("", GF_LOG_DEBUG, "Returning %d.", ret);
>>>     CID 1223042:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "slave_url" going out of scope leaks the storage it points to.
1035             return ret;
1036     }
1037
1038
1039     static int
1040     _get_max_gsync_slave_num (dict_t *this, char *key, data_t *value, void *data)


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/987?tab=overview

To unsubscribe from the email notification for new defects, http://scan5.coverity.com/cgi-bin/unsubscribe.py





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20140616/7eb9eedb/attachment-0001.html>


More information about the Gluster-devel mailing list