[Gluster-devel] Fwd: New Defects reported by Coverity Scan for GlusterFS
Lalatendu Mohanty
lmohanty at redhat.com
Mon Feb 24 14:55:26 UTC 2014
-------- Original Message --------
Subject: New Defects reported by Coverity Scan for GlusterFS
Date: Mon, 24 Feb 2014 06:54:53 -0800
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 9 of 9 defect(s)
** CID 1124659: Negative array index read (NEGATIVE_RETURNS)
/cli/src/cli-xml-output.c: 3340 in cli_xml_output_vol_rebalance_status()
** CID 1124381: Logically dead code (DEADCODE)
/cli/src/cli-xml-output.c: 2422 in cli_xml_output_vol_info_option()
** CID 1124380: Logically dead code (DEADCODE)
/cli/src/cli-xml-output.c: 2424 in cli_xml_output_vol_info_option()
** CID 1124829: Dereference before null check (REVERSE_INULL)
/cli/src/cli-xml-output.c: 71 in cli_begin_xml_output()
** CID 1124816: Dereference before null check (REVERSE_INULL)
/xlators/mgmt/glusterd/src/glusterd-volgen.c: 1825 in init_sethelp_xml_doc()
** CID 1124815: Dereference before null check (REVERSE_INULL)
/xlators/mgmt/glusterd/src/glusterd-volgen.c: 1835 in init_sethelp_xml_doc()
** CID 1124731: Resource leak (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-brick-ops.c: 974 in _glusterd_restart_gsync_session()
** CID 1124727: Resource leak (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 2467 in glusterd_op_stage_gsync_set()
** CID 1124795: Resource leak (RESOURCE_LEAK)
/xlators/protocol/client/src/client-helpers.c: 237 in unserialize_rsp_direntp()
________________________________________________________________________________________________________
*** CID 1124659: Negative array index read (NEGATIVE_RETURNS)
/cli/src/cli-xml-output.c: 3340 in cli_xml_output_vol_rebalance_status()
3334 XML_RET_CHECK_AND_GOTO (ret, out);
3335
3336 ret = xmlTextWriterWriteFormatElement (writer,(xmlChar *)"status",
3337 "%d", overall_status);
3338 XML_RET_CHECK_AND_GOTO (ret, out);
3339
>>> CID 1124659: Negative array index read (NEGATIVE_RETURNS)
>>> Using variable "overall_status" as an index to array "cli_vol_task_status_str".
3340 ret = xmlTextWriterWriteFormatElement (writer,(xmlChar *)"statusStr",
3341 "%s",
3342 cli_vol_task_status_str[overall_status]);
3343 XML_RET_CHECK_AND_GOTO (ret, out);
3344
3345 ret = xmlTextWriterWriteFormatElement (writer,(xmlChar *)"runtime",
________________________________________________________________________________________________________
*** CID 1124381: Logically dead code (DEADCODE)
/cli/src/cli-xml-output.c: 2422 in cli_xml_output_vol_info_option()
2416 while (ptr1) {
2417 if (*ptr1 != *ptr2)
2418 break;
2419 ptr1++;
2420 ptr2++;
2421 if (!ptr1)
>>> CID 1124381: Logically dead code (DEADCODE)
>>> Execution cannot reach this statement "goto out;".
2422 goto out;
2423 if (!ptr2)
2424 goto out;
2425 }
2426 if (*ptr2 == '\0')
2427 goto out;
________________________________________________________________________________________________________
*** CID 1124380: Logically dead code (DEADCODE)
/cli/src/cli-xml-output.c: 2424 in cli_xml_output_vol_info_option()
2418 break;
2419 ptr1++;
2420 ptr2++;
2421 if (!ptr1)
2422 goto out;
2423 if (!ptr2)
>>> CID 1124380: Logically dead code (DEADCODE)
>>> Execution cannot reach this statement "goto out;".
2424 goto out;
2425 }
2426 if (*ptr2 == '\0')
2427 goto out;
2428
2429 /* <option> */
________________________________________________________________________________________________________
*** CID 1124829: Dereference before null check (REVERSE_INULL)
/cli/src/cli-xml-output.c: 71 in cli_begin_xml_output()
65 int
66 cli_begin_xml_output (xmlTextWriterPtr *writer, xmlDocPtr *doc)
67 {
68 int ret = -1;
69
70 *writer = xmlNewTextWriterDoc (doc, 0);
>>> CID 1124829: Dereference before null check (REVERSE_INULL)
>>> Null-checking "writer" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
71 if (writer == NULL) {
72 ret = -1;
73 goto out;
74 }
75
76 ret = xmlTextWriterStartDocument (*writer, "1.0", "UTF-8", "yes");
________________________________________________________________________________________________________
*** CID 1124816: Dereference before null check (REVERSE_INULL)
/xlators/mgmt/glusterd/src/glusterd-volgen.c: 1825 in init_sethelp_xml_doc()
1819 static int
1820 init_sethelp_xml_doc (xmlTextWriterPtr *writer, xmlBufferPtr *buf)
1821 {
1822 int ret;
1823
1824 *buf = xmlBufferCreateSize (8192);
>>> CID 1124816: Dereference before null check (REVERSE_INULL)
>>> Null-checking "buf" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1825 if (buf == NULL) {
1826 gf_log ("glusterd", GF_LOG_ERROR, "Error creating the xml "
1827 "buffer");
1828 ret = -1;
1829 goto out;
1830 }
________________________________________________________________________________________________________
*** CID 1124815: Dereference before null check (REVERSE_INULL)
/xlators/mgmt/glusterd/src/glusterd-volgen.c: 1835 in init_sethelp_xml_doc()
1829 goto out;
1830 }
1831
1832 xmlBufferSetAllocationScheme (*buf,XML_BUFFER_ALLOC_DOUBLEIT);
1833
1834 *writer = xmlNewTextWriterMemory(*buf, 0);
>>> CID 1124815: Dereference before null check (REVERSE_INULL)
>>> Null-checking "writer" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1835 if (writer == NULL) {
1836 gf_log ("glusterd", GF_LOG_ERROR, " Error creating the xml "
1837 "writer");
1838 ret = -1;
1839 goto out;
1840 }
________________________________________________________________________________________________________
*** CID 1124731: Resource leak (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-brick-ops.c: 974 in _glusterd_restart_gsync_session()
968 if (ret)
969 gf_log ("", GF_LOG_ERROR,
970 "Unable to restart gsync session.");
971
972 out:
973 gf_log ("", GF_LOG_DEBUG, "Returning %d.", ret);
>>> CID 1124731: Resource leak (RESOURCE_LEAK)
>>> Variable "path_list" going out of scope leaks the storage it points to.
974 return ret;
975 }
976
977 /* op-sm */
978
979 int
________________________________________________________________________________________________________
*** CID 1124727: Resource leak (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 2467 in glusterd_op_stage_gsync_set()
2461
2462 break;
2463 }
2464
2465 out:
2466 gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
>>> CID 1124727: Resource leak (RESOURCE_LEAK)
>>> Variable "path_list" going out of scope leaks the storage it points to.
2467 return ret;
2468 }
2469
2470 static int
2471 stop_gsync (char *master, char *slave, char **msg,
2472 char *conf_path, gf_boolean_t is_force)
________________________________________________________________________________________________________
*** CID 1124795: Resource leak (RESOURCE_LEAK)
/xlators/protocol/client/src/client-helpers.c: 237 in unserialize_rsp_direntp()
231
232 trav = trav->nextentry;
233 }
234
235 ret = 0;
236 out:
>>> CID 1124795: Resource leak (RESOURCE_LEAK)
>>> Variable "buf" going out of scope leaks the storage it points to.
237 return ret;
238 }
239
240 int
241 clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp)
242 {
________________________________________________________________________________________________________
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/20140224/d78752c9/attachment-0001.html>
More information about the Gluster-devel
mailing list