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

2014-12-25 Thread Atin Mukherjee


On 12/25/2014 12:09 PM, Vijay Bellur wrote:
> A single bug reported by covscan this time.
> 
> KP, Kaushal - can you please check this out?

http://review.gluster.org/#/c/9338/ should solve it.

~Atin
> 
> Thanks,
> Vijay
> 
> 
>  Forwarded Message 
> Subject: New Defects reported by Coverity Scan for GlusterFS
> Date: Wed, 24 Dec 2014 01:55:19 -0800
> From: scan-ad...@coverity.com
> To: vbel...@redhat.com
> 
> 
> Hi,
> 
> Please find the latest report on new defect(s) introduced to GlusterFS
> found with Coverity Scan.
> 
> 1 new defect(s) introduced to GlusterFS found with Coverity Scan.
> 14 defect(s), reported by Coverity Scan earlier, were marked fixed in
> the recent build analyzed by Coverity Scan.
> 
> New defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
> 
> 
> ** CID 1260432:  Out-of-bounds access  (OVERRUN)
> /xlators/mgmt/glusterd/src/glusterd.c: 1323 in glusterd_stop_uds_listener()
> 
> 
> 
> 
> *** CID 1260432:  Out-of-bounds access  (OVERRUN)
> /xlators/mgmt/glusterd/src/glusterd.c: 1323 in glusterd_stop_uds_listener()
> 1317 (void) rpcsvc_unregister_notify (conf->uds_rpc,
> 1318 glusterd_uds_rpcsvc_notify,
> 1319  this);
> 1320
> 1321 sock_data = dict_get (this->options, "glusterd-sockfile");
> 1322 if (!sock_data) {
 CID 1260432:  Out-of-bounds access  (OVERRUN)
 Overrunning array "sockfile" of 109 bytes by passing it to a
 function which accesses it at byte offset 4095 using argument "4096UL".
> 1323 strncpy (sockfile, DEFAULT_GLUSTERD_SOCKFILE,
> PATH_MAX);
> 1324 } else {
> 1325 strncpy (sockfile, sock_data->data, PATH_MAX);
> 1326 }
> 1327 unlink (sockfile);
> 1328
> 
> 
> 
> 
> To view the defects in Coverity Scan visit,
> http://scan.coverity.com/projects/987?tab=overview
> 
> To manage Coverity Scan email notifications for "vbel...@redhat.com",
> click
> http://scan.coverity.com/subscriptions/edit?email=vbellur%40redhat.com&token=5b81d38a8ddcb1eaca7a29dec26cbdcc
> .
> 
> 
> 
> ___
> Gluster-devel mailing list
> Gluster-devel@gluster.org
> http://www.gluster.org/mailman/listinfo/gluster-devel
___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://www.gluster.org/mailman/listinfo/gluster-devel


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

2014-12-24 Thread Vijay Bellur

A single bug reported by covscan this time.

KP, Kaushal - can you please check this out?

Thanks,
Vijay


 Forwarded Message 
Subject: New Defects reported by Coverity Scan for GlusterFS
Date: Wed, 24 Dec 2014 01:55:19 -0800
From: scan-ad...@coverity.com
To: vbel...@redhat.com


Hi,

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


1 new defect(s) introduced to GlusterFS found with Coverity Scan.
14 defect(s), reported by Coverity Scan earlier, were marked fixed in 
the recent build analyzed by Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1260432:  Out-of-bounds access  (OVERRUN)
/xlators/mgmt/glusterd/src/glusterd.c: 1323 in glusterd_stop_uds_listener()



*** CID 1260432:  Out-of-bounds access  (OVERRUN)
/xlators/mgmt/glusterd/src/glusterd.c: 1323 in glusterd_stop_uds_listener()
1317 (void) rpcsvc_unregister_notify (conf->uds_rpc,
1318 
glusterd_uds_rpcsvc_notify,

1319  this);
1320
1321 sock_data = dict_get (this->options, "glusterd-sockfile");
1322 if (!sock_data) {

CID 1260432:  Out-of-bounds access  (OVERRUN)
Overrunning array "sockfile" of 109 bytes by passing it to a function which accesses 
it at byte offset 4095 using argument "4096UL".
1323 strncpy (sockfile, DEFAULT_GLUSTERD_SOCKFILE, 
PATH_MAX);

1324 } else {
1325 strncpy (sockfile, sock_data->data, PATH_MAX);
1326 }
1327 unlink (sockfile);
1328



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


To manage Coverity Scan email notifications for "vbel...@redhat.com", 
click 
http://scan.coverity.com/subscriptions/edit?email=vbellur%40redhat.com&token=5b81d38a8ddcb1eaca7a29dec26cbdcc 
.




___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://www.gluster.org/mailman/listinfo/gluster-devel


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

2014-11-30 Thread Atin Mukherjee


On 12/01/2014 12:31 PM, Vijay Bellur wrote:
> Hi All,
> 
> Shall we set a goal for ourselves to be Coverity Scan clean by GlusterFS
> 3.7?
> 
> I think fixing problems reported in the incremental reports here would
> be a good way of keeping the number of static analysis defects in
> control. It would be great if developers who checked in code recently to
> the files mentioned in these reports pay attention to the results.
+1
> 
> Thanks,
> Vijay
> 
> On 11/28/2014 12:37 PM, Lalatendu Mohanty wrote:
>>
>> Guideline for fixing Coverity issues :
>> http://www.gluster.org/community/documentation/index.php/Fixing_Issues_Reported_By_Tools_For_Static_Code_Analysis#Coverity
>>
>>
>> Thanks,
>> Lala
>>
>>  Forwarded Message 
>> Subject: New Defects reported by Coverity Scan for GlusterFS
>> Date: Thu, 27 Nov 2014 12:31:06 -0800
>> From: scan-ad...@coverity.com
>> To: l...@redhat.com
>>
>>
>>
>> Hi,
>>
>> Please find the latest report on new defect(s) introduced to GlusterFS
>> found with Coverity Scan.
>>
>> 13 new defect(s) introduced to GlusterFS found with Coverity Scan.
>> 97 defect(s), reported by Coverity Scan earlier, were marked fixed in
>> the recent build analyzed by Coverity Scan.
>>
>> New defect(s) Reported-by: Coverity Scan
>> Showing 13 of 13 defect(s)
>>
>>
>> ** CID 1256178:  Logically dead code  (DEADCODE)
>> /api/src/glfs.c: 153 in glusterfs_ctx_defaults_init()
>>
>> ** CID 1256180:  Logically dead code  (DEADCODE)
>> /api/src/glfs.c: 161 in glusterfs_ctx_defaults_init()
>>
>> ** CID 1256176:  Logically dead code  (DEADCODE)
>> /glusterfsd/src/glusterfsd.c: 1426 in glusterfs_ctx_defaults_init()
>>
>> ** CID 1256179:  Dereference after null check  (FORWARD_NULL)
>> /xlators/nfs/server/src/mount3.c: 1082 in mnt3_readlink_cbk()
>>
>> ** CID 1256177:  Explicit null dereferenced  (FORWARD_NULL)
>> /api/src/glfs-fops.c: 702 in pub_glfs_preadv_async()
>>
>> ** CID 1256175:  Array compared against 0  (NO_EFFECT)
>> /xlators/mgmt/glusterd/src/glusterd-snapshot.c: 2433 in
>> glusterd_lvm_snapshot_remove()
>> /xlators/mgmt/glusterd/src/glusterd-snapshot.c: 2433 in
>> glusterd_lvm_snapshot_remove()
>>
>> ** CID 1256173:  Thread deadlock  (ORDER_REVERSAL)
>> /xlators/cluster/ec/src/ec-common.c: 1335 in ec_unlock_timer_add()
>>
>> ** CID 1256174:  Copy into fixed size buffer  (STRING_OVERFLOW)
>> /xlators/mgmt/glusterd/src/glusterd.c: 287 in glusterd_dump_peer()
>>
>> ** CID 1256172:  Copy into fixed size buffer  (STRING_OVERFLOW)
>> /xlators/mgmt/glusterd/src/glusterd.c: 330 in
>> glusterd_dump_peer_rpcstat()
>>
>> ** CID 1256171:  Copy into fixed size buffer  (STRING_OVERFLOW)
>> /xlators/mgmt/glusterd/src/glusterd-handshake.c: 279 in
>> build_volfile_path()
>>
>> ** CID 1238183:  Missing break in switch  (MISSING_BREAK)
>> /xlators/mgmt/glusterd/src/glusterd-rebalance.c: 577 in
>> glusterd_op_stage_rebalance()
>>
>> ** CID 1228602:  Use of untrusted scalar value  (TAINTED_SCALAR)
>> /xlators/mount/fuse/src/fuse-bridge.c: 4843 in fuse_thread_proc()
>>
>> ** CID 1228603:  Use of untrusted scalar value  (TAINTED_SCALAR)
>> /xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in
>> glusterd_readin_file()
>> /xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in
>> glusterd_readin_file()
>> /xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in
>> glusterd_readin_file()
>> /xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in
>> glusterd_readin_file()
>>
>>
>> 
>>
>> *** CID 1256178:  Logically dead code  (DEADCODE)
>> /api/src/glfs.c: 153 in glusterfs_ctx_defaults_init()
>> 147
>> 148 pthread_mutex_init (&(ctx->lock), NULL);
>> 149
>> 150 ret = 0;
>> 151 err:
>> 152 if (ret && pool) {
> CID 1256178:  Logically dead code  (DEADCODE)
> Execution cannot reach this statement "if (pool->frame_mem_pool)
>>   ...".
>> 153 if (pool->frame_mem_pool)
>> 154 mem_pool_destroy (pool->frame_mem_pool);
>> 155 if (pool->stack_mem_pool)
>> 156 mem_pool_destroy (pool->stack_mem_pool);
>> 157 GF_FREE (pool);
>> 158 }
>>
>> 
>>
>> *** CID 1256180:  Logically dead code  (DEADCODE)
>> /api/src/glfs.c: 161 in glusterfs_ctx_defaults_init()
>> 155 if (pool->stack_mem_pool)
>> 156 mem_pool_destroy (pool->stack_mem_pool);
>> 157 GF_FREE (pool);
>> 158 }
>> 159
>> 160 if (ret && ctx) {
> CID 1256180:  Logically dead code  (DEADCODE)
> Execution cannot reach this statement "if (ctx->stub_mem_pool)
>>m...".
>> 161 if (ctx->stub_mem_pool)
>> 162 mem_pool_destroy (ctx->stub_mem_pool);
>> 163 if (ctx->dict_pool)
>> 164 mem_pool_destroy (ctx->dict_pool);
>> 165  

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

2014-11-30 Thread Vijay Bellur

Hi All,

Shall we set a goal for ourselves to be Coverity Scan clean by GlusterFS 
3.7?


I think fixing problems reported in the incremental reports here would 
be a good way of keeping the number of static analysis defects in 
control. It would be great if developers who checked in code recently to 
the files mentioned in these reports pay attention to the results.


Thanks,
Vijay

On 11/28/2014 12:37 PM, Lalatendu Mohanty wrote:


Guideline for fixing Coverity issues :
http://www.gluster.org/community/documentation/index.php/Fixing_Issues_Reported_By_Tools_For_Static_Code_Analysis#Coverity

Thanks,
Lala

 Forwarded Message 
Subject:New Defects reported by Coverity Scan for GlusterFS
Date:   Thu, 27 Nov 2014 12:31:06 -0800
From:   scan-ad...@coverity.com
To: l...@redhat.com



Hi,

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

13 new defect(s) introduced to GlusterFS found with Coverity Scan.
97 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 13 of 13 defect(s)


** CID 1256178:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 153 in glusterfs_ctx_defaults_init()

** CID 1256180:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 161 in glusterfs_ctx_defaults_init()

** CID 1256176:  Logically dead code  (DEADCODE)
/glusterfsd/src/glusterfsd.c: 1426 in glusterfs_ctx_defaults_init()

** CID 1256179:  Dereference after null check  (FORWARD_NULL)
/xlators/nfs/server/src/mount3.c: 1082 in mnt3_readlink_cbk()

** CID 1256177:  Explicit null dereferenced  (FORWARD_NULL)
/api/src/glfs-fops.c: 702 in pub_glfs_preadv_async()

** CID 1256175:  Array compared against 0  (NO_EFFECT)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 2433 in 
glusterd_lvm_snapshot_remove()
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 2433 in 
glusterd_lvm_snapshot_remove()

** CID 1256173:  Thread deadlock  (ORDER_REVERSAL)
/xlators/cluster/ec/src/ec-common.c: 1335 in ec_unlock_timer_add()

** CID 1256174:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd.c: 287 in glusterd_dump_peer()

** CID 1256172:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd.c: 330 in glusterd_dump_peer_rpcstat()

** CID 1256171:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-handshake.c: 279 in build_volfile_path()

** CID 1238183:  Missing break in switch  (MISSING_BREAK)
/xlators/mgmt/glusterd/src/glusterd-rebalance.c: 577 in 
glusterd_op_stage_rebalance()

** CID 1228602:  Use of untrusted scalar value  (TAINTED_SCALAR)
/xlators/mount/fuse/src/fuse-bridge.c: 4843 in fuse_thread_proc()

** CID 1228603:  Use of untrusted scalar value  (TAINTED_SCALAR)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()



*** CID 1256178:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 153 in glusterfs_ctx_defaults_init()
147
148 pthread_mutex_init (&(ctx->lock), NULL);
149
150 ret = 0;
151 err:
152 if (ret && pool) {

CID 1256178:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "if (pool->frame_mem_pool)

  ...".
153 if (pool->frame_mem_pool)
154 mem_pool_destroy (pool->frame_mem_pool);
155 if (pool->stack_mem_pool)
156 mem_pool_destroy (pool->stack_mem_pool);
157 GF_FREE (pool);
158 }


*** CID 1256180:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 161 in glusterfs_ctx_defaults_init()
155 if (pool->stack_mem_pool)
156 mem_pool_destroy (pool->stack_mem_pool);
157 GF_FREE (pool);
158 }
159
160 if (ret && ctx) {

CID 1256180:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "if (ctx->stub_mem_pool)

   m...".
161 if (ctx->stub_mem_pool)
162 mem_pool_destroy (ctx->stub_mem_pool);
163 if (ctx->dict_pool)
164 mem_pool_destroy (ctx->dict_pool);
165 if (ctx->dict_data_pool)
166 mem_pool_destroy (ctx->dict_data_pool);


*** CID 1256176:  Logically dead code  (DEADCODE)

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

2014-11-27 Thread Lalatendu Mohanty


Guideline for fixing Coverity issues :
http://www.gluster.org/community/documentation/index.php/Fixing_Issues_Reported_By_Tools_For_Static_Code_Analysis#Coverity

Thanks,
Lala

 Forwarded Message 
Subject:New Defects reported by Coverity Scan for GlusterFS
Date:   Thu, 27 Nov 2014 12:31:06 -0800
From:   scan-ad...@coverity.com
To: l...@redhat.com



Hi,

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

13 new defect(s) introduced to GlusterFS found with Coverity Scan.
97 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 13 of 13 defect(s)


** CID 1256178:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 153 in glusterfs_ctx_defaults_init()

** CID 1256180:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 161 in glusterfs_ctx_defaults_init()

** CID 1256176:  Logically dead code  (DEADCODE)
/glusterfsd/src/glusterfsd.c: 1426 in glusterfs_ctx_defaults_init()

** CID 1256179:  Dereference after null check  (FORWARD_NULL)
/xlators/nfs/server/src/mount3.c: 1082 in mnt3_readlink_cbk()

** CID 1256177:  Explicit null dereferenced  (FORWARD_NULL)
/api/src/glfs-fops.c: 702 in pub_glfs_preadv_async()

** CID 1256175:  Array compared against 0  (NO_EFFECT)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 2433 in 
glusterd_lvm_snapshot_remove()
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 2433 in 
glusterd_lvm_snapshot_remove()

** CID 1256173:  Thread deadlock  (ORDER_REVERSAL)
/xlators/cluster/ec/src/ec-common.c: 1335 in ec_unlock_timer_add()

** CID 1256174:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd.c: 287 in glusterd_dump_peer()

** CID 1256172:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd.c: 330 in glusterd_dump_peer_rpcstat()

** CID 1256171:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-handshake.c: 279 in build_volfile_path()

** CID 1238183:  Missing break in switch  (MISSING_BREAK)
/xlators/mgmt/glusterd/src/glusterd-rebalance.c: 577 in 
glusterd_op_stage_rebalance()

** CID 1228602:  Use of untrusted scalar value  (TAINTED_SCALAR)
/xlators/mount/fuse/src/fuse-bridge.c: 4843 in fuse_thread_proc()

** CID 1228603:  Use of untrusted scalar value  (TAINTED_SCALAR)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 2131 in glusterd_readin_file()



*** CID 1256178:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 153 in glusterfs_ctx_defaults_init()
147
148 pthread_mutex_init (&(ctx->lock), NULL);
149
150 ret = 0;
151 err:
152 if (ret && pool) {

CID 1256178:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "if (pool->frame_mem_pool)

 ...".
153 if (pool->frame_mem_pool)
154 mem_pool_destroy (pool->frame_mem_pool);
155 if (pool->stack_mem_pool)
156 mem_pool_destroy (pool->stack_mem_pool);
157 GF_FREE (pool);
158 }


*** CID 1256180:  Logically dead code  (DEADCODE)
/api/src/glfs.c: 161 in glusterfs_ctx_defaults_init()
155 if (pool->stack_mem_pool)
156 mem_pool_destroy (pool->stack_mem_pool);
157 GF_FREE (pool);
158 }
159
160 if (ret && ctx) {

CID 1256180:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "if (ctx->stub_mem_pool)

  m...".
161 if (ctx->stub_mem_pool)
162 mem_pool_destroy (ctx->stub_mem_pool);
163 if (ctx->dict_pool)
164 mem_pool_destroy (ctx->dict_pool);
165 if (ctx->dict_data_pool)
166 mem_pool_destroy (ctx->dict_data_pool);


*** CID 1256176:  Logically dead code  (DEADCODE)
/glusterfsd/src/glusterfsd.c: 1426 in glusterfs_ctx_defaults_init()
1420 lim.rlim_max = RLIM_INFINITY;
1421 setrlimit (RLIMIT_CORE, &lim);
1422
1423 ret = 0;
1424 out:
1425

CID 1256176:  Logically dead code  (DEADCODE)
Execution cannot reach this expression "ctx" inside statement "if (ret && 
ctx) {

  if (ctx...".
1426 if (ret && ctx) {
1427 if (ctx->poo

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

2014-09-11 Thread Lalatendu Mohanty


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

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

 Original Message 
Subject:New Defects reported by Coverity Scan for GlusterFS
Date:   Thu, 11 Sep 2014 00:02:11 -0700
From:   scan-ad...@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 4 of 4 defect(s)


** CID 1238186:  Logically dead code  (DEADCODE)
/xlators/cluster/afr/src/afr-dir-write.c: 339 in afr_mark_new_entry_changelog()

** CID 1238185:  Explicit null dereferenced  (FORWARD_NULL)
/xlators/features/snapview-server/src/snapview-server-mgmt.c: 476 in 
svs_get_snapshot_list()

** CID 1238184:  Explicit null dereferenced  (FORWARD_NULL)
/xlators/features/snapview-server/src/snapview-server-mgmt.c: 115 in 
svs_mgmt_init()

** CID 1238183:  Missing break in switch  (MISSING_BREAK)
/xlators/mgmt/glusterd/src/glusterd-rebalance.c: 577 in 
glusterd_op_stage_rebalance()



*** CID 1238186:  Logically dead code  (DEADCODE)
/xlators/cluster/afr/src/afr-dir-write.c: 339 in afr_mark_new_entry_changelog()
333 break;
334 }
335
336 new_frame = NULL;
337 out:
338 if (changelog)

CID 1238186:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "afr_matrix_cleanup(changelo...".

339 afr_matrix_cleanup (changelog, priv->child_count);
340 if (new_frame)
341 AFR_STACK_DESTROY (new_frame);
342 if (xattr)
343 dict_unref (xattr);
344 return;


*** CID 1238185:  Explicit null dereferenced  (FORWARD_NULL)
/xlators/features/snapview-server/src/snapview-server-mgmt.c: 476 in 
svs_get_snapshot_list()
470 if (frame_cleanup) {
471 /*
472  * Destroy the frame if we encountered an error
473  * Else we need to clean it up in
474  * mgmt_get_snapinfo_cbk
475  */

CID 1238185:  Explicit null dereferenced  (FORWARD_NULL)
Dereferencing null pointer "frame".

476 SVS_STACK_DESTROY (frame);
477 }
478
479 return ret;


*** CID 1238184:  Explicit null dereferenced  (FORWARD_NULL)
/xlators/features/snapview-server/src/snapview-server-mgmt.c: 115 in 
svs_mgmt_init()
109 ret = 0;
110
111 gf_log (this->name, GF_LOG_DEBUG, "svs mgmt init successful");
112
113 out:
114 if (ret) {

CID 1238184:  Explicit null dereferenced  (FORWARD_NULL)
Dereferencing null pointer "priv".

115 rpc_clnt_connection_cleanup (&priv->rpc->conn);
116 rpc_clnt_unref (priv->rpc);
117 priv->rpc = NULL;
118 }
119
120 return ret;


*** CID 1238183:  Missing break in switch  (MISSING_BREAK)
/xlators/mgmt/glusterd/src/glusterd-rebalance.c: 577 in 
glusterd_op_stage_rebalance()
571"disconnect those clients before 
"
572"attempting this command 
again.",
573volname);
574 goto out;
575 }
576

CID 1238183:  Missing break in switch  (MISSING_BREAK)
The above case falls through to this one.

577 case GF_DEFRAG_CMD_START_FORCE:
578 if (is_origin_glusterd (dict)) {
579 op_ctx = glusterd_op_get_ctx ();
580 if (!op_ctx) {
581 ret = -1;
582 gf_log (this->name, GF_LOG_ERROR,



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





___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-devel


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

2014-08-04 Thread Lalatendu Mohanty



To fix these Coverity issues , please check the below link for 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:   Mon, 04 Aug 2014 02:31:28 -0700
From:   scan-ad...@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 3 of 3 defect(s)


** CID 1229877:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4061 in 
glusterd_add_brick_to_snap_volume()
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4062 in 
glusterd_add_brick_to_snap_volume()
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4049 in 
glusterd_add_brick_to_snap_volume()
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4050 in 
glusterd_add_brick_to_snap_volume()

** CID 1229876:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 13482 in glusterd_update_mntopts()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 13481 in glusterd_update_mntopts()

** CID 1229878:  Time of check time of use  (TOCTOU)
/xlators/features/changelog/lib/src/gf-changelog.c: 475 in 
gf_changelog_register()



*** CID 1229877:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4061 in 
glusterd_add_brick_to_snap_volume()
4055
4056 snprintf (key, sizeof(key) - 1, "vol%"PRId64".mnt_opts%d", 
volcount,
4057   brick_count);
4058 ret = dict_get_str (dict, key, &value);
4059 if (!ret) {
4060 /* Update the mnt_opts in original brickinfo as well */

CID 1229877:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 1024 byte fixed-size string "original_brickinfo->mnt_opts" by 
copying "value" without checking the length.

4061 strcpy (original_brickinfo->mnt_opts, value);
4062 strcpy (snap_brickinfo->mnt_opts, value);
4063 } else {
4064 if (is_origin_glusterd (dict) == _gf_true)
4065 add_missed_snap = _gf_true;
4066 }
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4062 in 
glusterd_add_brick_to_snap_volume()
4056 snprintf (key, sizeof(key) - 1, "vol%"PRId64".mnt_opts%d", 
volcount,
4057   brick_count);
4058 ret = dict_get_str (dict, key, &value);
4059 if (!ret) {
4060 /* Update the mnt_opts in original brickinfo as well */
4061 strcpy (original_brickinfo->mnt_opts, value);

CID 1229877:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 1024 byte fixed-size string "snap_brickinfo->mnt_opts" by 
copying "value" without checking the length.

4062 strcpy (snap_brickinfo->mnt_opts, value);
4063 } else {
4064 if (is_origin_glusterd (dict) == _gf_true)
4065 add_missed_snap = _gf_true;
4066 }
4067
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4049 in 
glusterd_add_brick_to_snap_volume()
4043
4044 snprintf (key, sizeof(key) - 1, "vol%"PRId64".fstype%d", 
volcount,
4045   brick_count);
4046 ret = dict_get_str (dict, key, &value);
4047 if (!ret) {
4048 /* Update the fstype in original brickinfo as well */

CID 1229877:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 255 byte fixed-size string "original_brickinfo->fstype" by 
copying "value" without checking the length.

4049 strcpy (original_brickinfo->fstype, value);
4050 strcpy (snap_brickinfo->fstype, value);
4051 } else {
4052 if (is_origin_glusterd (dict) == _gf_true)
4053 add_missed_snap = _gf_true;
4054 }
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4050 in 
glusterd_add_brick_to_snap_volume()
4044 snprintf (key, sizeof(key) - 1, "vol%"PRId64".fstype%d", 
volcount,
4045   brick_count);
4046 ret = dict_get_str (dict, key, &value);
4047 if (!ret) {
4048 /* Update the fstype in original brickinfo as well */
4049 strcpy (original_brickinfo->fstype, value);

CID 1229877:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 255 byte fixed-size string "snap_brickinfo->fstype" by copying 
"value" without checking the length.

4050 strcpy (snap_brickinfo->fstype, value);
4051 } else {
4052   

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

2014-07-22 Thread Lalatendu Mohanty



To fix these Coverity issues , please check the below link for 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:   Tue, 22 Jul 2014 07:06:56 -0700
From:   scan-ad...@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 7 of 7 defect(s)


** CID 1228599:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-store.c: 4069 in 
glusterd_store_retrieve_peers()

** CID 1228598:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-peer-utils.c: 531 in gd_add_friend_to_dict()

** CID 1228600:  Data race condition  (MISSING_LOCK)
/xlators/cluster/ec/src/ec-data.c: 155 in ec_fop_data_allocate()

** CID 1228601:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/features/snapview-server/src/snapview-server.c: 1660 in 
svs_add_xattrs_to_dict()

** CID 1228603:  Use of untrusted scalar value  (TAINTED_SCALAR)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 1987 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 1987 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 1987 in glusterd_readin_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 1987 in glusterd_readin_file()

** CID 1228602:  Use of untrusted scalar value  (TAINTED_SCALAR)
/xlators/mount/fuse/src/fuse-bridge.c: 4805 in fuse_thread_proc()

** CID 1124682:  Dereference null return value  (NULL_RETURNS)
/rpc/rpc-lib/src/rpc-drc.c: 502 in rpcsvc_add_op_to_cache()



*** CID 1228599:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-store.c: 4069 in 
glusterd_store_retrieve_peers()
4063 /* Set first hostname from peerinfo->hostnames to
4064  * peerinfo->hostname
4065  */
4066 address = list_entry (peerinfo->hostnames.next,
4067   glusterd_peer_hostname_t, 
hostname_list);
4068 if (!address) {

CID 1228599:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "ret = -1;".

4069 ret = -1;
4070 goto out;
4071 }
4072 peerinfo->hostname = gf_strdup (address->hostname);
4073
4074 ret = glusterd_friend_add_from_peerinfo (peerinfo, 1, 
NULL);


*** CID 1228598:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-peer-utils.c: 531 in gd_add_friend_to_dict()
525  */
526 memset (key, 0, sizeof (key));
527 snprintf (key, sizeof (key), "%s.hostname", prefix);
528 address = list_entry (&friend->hostnames, 
glusterd_peer_hostname_t,
529   hostname_list);
530 if (!address) {

CID 1228598:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "ret = -1;".

531 ret = -1;
532 gf_log (this->name, GF_LOG_ERROR, "Could not retrieve first 
"
533 "address for peer");
534 goto out;
535 }
536 ret = dict_set_dynstr_with_alloc (dict, key, address->hostname);


*** CID 1228600:  Data race condition  (MISSING_LOCK)
/xlators/cluster/ec/src/ec-data.c: 155 in ec_fop_data_allocate()
149
150 mem_put(fop);
151
152 return NULL;
153 }
154 fop->id = id;

CID 1228600:  Data race condition  (MISSING_LOCK)
Accessing "fop->refs" without holding lock "_ec_fop_data.lock". Elsewhere, 
"fop->refs" is accessed with "_ec_fop_data.lock" held 7 out of 8 times.

155 fop->refs = 1;
156
157 fop->flags = flags;
158 fop->minimum = minimum;
159 fop->mask = target;
160


*** CID 1228601:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/features/snapview-server/src/snapview-server.c: 1660 in 
svs_add_xattrs_to_dict()
1654 GF_VALIDATE_OR_GOTO (this->name, dict, out);
1655 GF_VALIDATE_OR_GOTO (this->name, list, out);
1656
1657 remaining_size = size;
1658 list_offset = 0;
1659 while (remaining_size > 0) {

CID 1228601:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 4096 byte fixed-size string "keybuffer" by cop

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

2014-07-15 Thread Lalatendu Mohanty


To fix these Coverity issues , please check the below link for 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:   Mon, 14 Jul 2014 23:47:00 -0700
From:   scan-ad...@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 20 of 23 defect(s)


** CID 1226162:  Logically dead code  (DEADCODE)
/xlators/cluster/ec/src/ec-method.c: 119 in ec_method_decode()

** CID 1226164:  Division or modulo by zero  (DIVIDE_BY_ZERO)
/xlators/cluster/dht/src/dht-selfheal.c: 1068 in 
dht_selfheal_layout_new_directory()

** CID 1226163:  Division or modulo by zero  (DIVIDE_BY_ZERO)
/xlators/cluster/dht/src/dht-selfheal.c: 1062 in 
dht_selfheal_layout_new_directory()

** CID 1226165:  Null pointer dereference  (FORWARD_NULL)
/libglusterfs/src/client_t.c: 294 in gf_client_get()
/libglusterfs/src/client_t.c: 294 in gf_client_get()

** CID 1226177:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-dir-write.c: 181 in ec_manager_create()

** CID 1226176:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-generic.c: 911 in ec_manager_lookup()

** CID 1226175:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-inode-read.c: 671 in ec_manager_open()

** CID 1226174:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-inode-write.c: 1366 in ec_manager_truncate()

** CID 1226173:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-inode-write.c: 2022 in ec_manager_writev()

** CID 1226172:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-locks.c: 218 in ec_manager_entrylk()

** CID 1226171:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-locks.c: 649 in ec_manager_inodelk()

** CID 1226170:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-locks.c: 1134 in ec_manager_lk()

** CID 1226169:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-inode-read.c: 1239 in ec_manager_readv()

** CID 1226168:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-dir-read.c: 366 in ec_manager_readdir()

** CID 1226167:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-heal.c: 1164 in ec_manager_heal()

** CID 1226166:  Missing break in switch  (MISSING_BREAK)
/xlators/cluster/ec/src/ec-heal.c: 1224 in ec_manager_heal()

** CID 1226180:  Data race condition  (MISSING_LOCK)
/xlators/cluster/ec/src/ec-heal.c: 945 in ec_heal_needs_data_rebuild()

** CID 1226179:  Data race condition  (MISSING_LOCK)
/xlators/cluster/ec/src/ec-heal.c: 94 in ec_heal_lookup_resume()

** CID 1226178:  Data race condition  (MISSING_LOCK)
/xlators/cluster/ec/src/ec-heal.c: 93 in ec_heal_lookup_resume()

** CID 1226181:  Thread deadlock  (ORDER_REVERSAL)
/xlators/cluster/ec/src/ec-heal.c: 458 in ec_heal_init()



*** CID 1226162:  Logically dead code  (DEADCODE)
/xlators/cluster/ec/src/ec-method.c: 119 in ec_method_decode()
113 }
114 k = 0;
115 for (i = 0; i < columns; i++)
116 {
117 while ((mask & 1) != 0)
118 {

CID 1226162:  Logically dead code  (DEADCODE)
Execution cannot reach this statement "k++;".

119 k++;
120 mask >>= 1;
121 }
122 mtx[k][columns - 1] = 1;
123 for (j = columns - 1; j > 0; j--)
124 {


*** CID 1226164:  Division or modulo by zero  (DIVIDE_BY_ZERO)
/xlators/cluster/dht/src/dht-selfheal.c: 1068 in 
dht_selfheal_layout_new_directory()
1062 chunk = ((unsigned long) 0x) / total_size;
1063 gf_log (this->name, GF_LOG_INFO,
1064 "chunk size = 0x / %u = 0x%x",
1065 total_size, chunk);
1066 }
1067 else {

CID 1226164:  Division or modulo by zero  (DIVIDE_BY_ZERO)
In expression "4294967295UL / bricks_used", division by expression 
"bricks_used" which may be zero has undefined behavior.

1068 chunk = ((unsigned long) 0x) / bricks_used;
1069 }
1070
1071 start_subvol = dht_selfheal_layout_alloc_start (this, loc, 
layout);
1072
1073 /* clear out the range, as we are re-computing here */


*** CID 1226163:  Division or modulo by zero  (DIVIDE_BY_ZERO)
/xlators/cluster/dht/src/dht-selfheal.c: 1062 in 
dht_selfh

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

2014-06-19 Thread Lalatendu Mohanty


Interested to fix 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:   Thu, 19 Jun 2014 02:01:18 -0700
From:   scan-ad...@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 1 of 1 defect(s)


** CID 1223229:  Dereference after null check  (FORWARD_NULL)
/xlators/cluster/dht/src/dht-layout.c: 728 in dht_layout_dir_mismatch()
/xlators/cluster/dht/src/dht-layout.c: 739 in dht_layout_dir_mismatch()
/xlators/cluster/dht/src/dht-layout.c: 752 in dht_layout_dir_mismatch()
/xlators/cluster/dht/src/dht-layout.c: 764 in dht_layout_dir_mismatch()



*** CID 1223229:  Dereference after null check  (FORWARD_NULL)
/xlators/cluster/dht/src/dht-layout.c: 728 in dht_layout_dir_mismatch()
722 pos = idx;
723 break;
724 }
725 }
726
727 if (pos == -1) {

CID 1223229:  Dereference after null check  (FORWARD_NULL)
Dereferencing null pointer "loc".

728 gf_msg_debug (this->name, 0,
729   "%s - no layout info for subvolume %s",
730   loc->path, subvol->name);
731 ret = 1;
732 goto out;
733 }
/xlators/cluster/dht/src/dht-layout.c: 739 in dht_layout_dir_mismatch()
733 }
734
735 err = layout->list[pos].err;
736
737 if (!xattr) {
738 if (err == 0) {

CID 1223229:  Dereference after null check  (FORWARD_NULL)
Dereferencing null pointer "loc".

739 gf_log (this->name, GF_LOG_INFO,
740 "%s: xattr dictionary is NULL",
741 loc->path);
742 ret = -1;
743 }
744 goto out;
/xlators/cluster/dht/src/dht-layout.c: 752 in dht_layout_dir_mismatch()
746
747 dict_ret = dict_get_ptr (xattr, conf->xattr_name,
748  &disk_layout_raw);
749
750 if (dict_ret < 0) {
751 if (err == 0 && layout->list[pos].stop) {

CID 1223229:  Dereference after null check  (FORWARD_NULL)
Dereferencing null pointer "loc".

752 gf_log (this->name, GF_LOG_INFO,
753 "%s: Disk layout missing, gfid = %s",
754 loc->path, gfid);
755 ret = -1;
756 }
757 goto out;
/xlators/cluster/dht/src/dht-layout.c: 764 in dht_layout_dir_mismatch()
758 }
759
760 memcpy (disk_layout, disk_layout_raw, sizeof (disk_layout));
761
762 count  = ntoh32 (disk_layout[0]);
763 if (count != 1) {

CID 1223229:  Dereference after null check  (FORWARD_NULL)
Dereferencing null pointer "loc".

764 gf_msg (this->name, GF_LOG_ERROR, 0,
765 DHT_MSG_INVALID_DISK_LAYOUT,
766 "Invalid disk layout: invalid count %d,"
767 "path = %s, gfid = %s ", count, loc->path, 
gfid);
768 ret = -1;
769 goto out;



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





___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-devel


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

2014-06-16 Thread Lalatendu Mohanty


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-ad...@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 

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

2014-06-11 Thread Lalatendu Mohanty

FYI,

To fix these Coverity issues , please check the below link for 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:   Wed, 11 Jun 2014 06:36:17 -0700
From:   scan-ad...@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 2 of 2 defect(s)


** CID 1222523:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 3728 in 
gd_import_new_brick_snap_details()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 3737 in 
gd_import_new_brick_snap_details()

** CID 1222524:  Structurally dead code  (UNREACHABLE)
/cli/src/cli-rpc-ops.c: 8796 in gf_cli_snapshot_for_status()



*** CID 1222523:  Copy into fixed size buffer  (STRING_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 3728 in 
gd_import_new_brick_snap_details()
3722 snprintf (key, sizeof (key), "%s.device_path", prefix);
3723 ret = dict_get_str (dict, key, &snap_device);
3724 if (ret) {
3725 gf_log (this->name, GF_LOG_ERROR, "%s missing in 
payload", key);
3726 goto out;
3727 }

CID 1222523:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 4096 byte fixed-size string "brickinfo->device_path" by copying 
"snap_device" without checking the length.

3728 strcpy (brickinfo->device_path, snap_device);
3729
3730 memset (key, 0, sizeof (key));
3731 snprintf (key, sizeof (key), "%s.mount_dir", prefix);
3732 ret = dict_get_str (dict, key, &mount_dir);
3733 if (ret) {
/xlators/mgmt/glusterd/src/glusterd-utils.c: 3737 in 
gd_import_new_brick_snap_details()
3731 snprintf (key, sizeof (key), "%s.mount_dir", prefix);
3732 ret = dict_get_str (dict, key, &mount_dir);
3733 if (ret) {
3734 gf_log (this->name, GF_LOG_ERROR, "%s missing in 
payload", key);
3735 goto out;
3736 }

CID 1222523:  Copy into fixed size buffer  (STRING_OVERFLOW)
You might overrun the 4096 byte fixed-size string "brickinfo->mount_dir" by copying 
"mount_dir" without checking the length.

3737 strcpy (brickinfo->mount_dir, mount_dir);
3738
3739 out:
3740 return ret;
3741 }
3742


*** CID 1222524:  Structurally dead code  (UNREACHABLE)
/cli/src/cli-rpc-ops.c: 8796 in gf_cli_snapshot_for_status()
8790 dict_unref (snap_dict);
8791 }
8792 }
8793 out:
8794 return ret;
8795

CID 1222524:  Structurally dead code  (UNREACHABLE)
This code cannot be reached: "if (ret && snap_dict)

  dic...".
8796 if (ret && snap_dict)
8797 dict_unref (snap_dict);
8798 }
8799
8800 int32_t
8801 gf_cli_snapshot (call_frame_t *frame, xlator_t *this,



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





___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-devel


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

2014-06-03 Thread Lalatendu Mohanty


If you are interested to fix these Coverity issues , check the below 
link for 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:   Tue, 03 Jun 2014 08:22:38 -0700
From:   scan-ad...@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 14 of 14 defect(s)


** CID 1220068:  Missing parentheses  (CONSTANT_EXPRESSION_RESULT)
/xlators/features/snapview-server/src/snapview-server.c: 1265 in svs_fgetxattr()

** CID 1220067:  Missing parentheses  (CONSTANT_EXPRESSION_RESULT)
/xlators/features/snapview-server/src/snapview-server.c: 1158 in svs_getxattr()

** CID 1220066:  Logically dead code  (DEADCODE)
/xlators/features/snapview-server/src/snapview-server.c: 1268 in svs_fgetxattr()

** CID 1220065:  Logically dead code  (DEADCODE)
/xlators/features/snapview-server/src/snapview-server.c: 1160 in svs_getxattr()

** CID 1220064:  Logically dead code  (DEADCODE)
/xlators/features/snapview-server/src/snapview-server.c: 594 in 
svs_lookup_entry_point()

** CID 1220060:  Resource leak  (RESOURCE_LEAK)
/xlators/features/snapview-server/src/snapview-server.c: 1500 in 
svs_get_snapshot_list()

** CID 1220059:  Resource leak  (RESOURCE_LEAK)
/xlators/features/snapview-server/src/snapview-server.c: 1500 in 
svs_get_snapshot_list()

** CID 1220058:  Resource leak  (RESOURCE_LEAK)
/xlators/features/snapview-client/src/snapview-client.c: 1315 in svc_readdirp()

** CID 1220057:  Resource leak  (RESOURCE_LEAK)
/xlators/features/snapview-server/src/snapview-server.c: 860 in 
svs_lookup_entry()

** CID 1220063:  Improper use of negative value  (NEGATIVE_RETURNS)
/xlators/features/snapview-server/src/snapview-server.c: 1264 in svs_fgetxattr()

** CID 1220062:  Improper use of negative value  (NEGATIVE_RETURNS)
/xlators/features/snapview-server/src/snapview-server.c: 1157 in svs_getxattr()

** CID 1220061:  Array compared against 0  (NO_EFFECT)
/xlators/features/snapview-server/src/snapview-server.c: 693 in 
svs_lookup_gfid()

** CID 1220056:  Unused pointer value  (UNUSED_VALUE)
/xlators/features/snapview-server/src/snapview-server.c: 999 in svs_lookup()

** CID 1220055:  Use after free  (USE_AFTER_FREE)
/xlators/features/snapview-server/src/snapview-server.c: 1319 in svs_fgetxattr()
/xlators/features/snapview-server/src/snapview-server.c: 1319 in svs_fgetxattr()



*** CID 1220068:  Missing parentheses  (CONSTANT_EXPRESSION_RESULT)
/xlators/features/snapview-server/src/snapview-server.c: 1265 in svs_fgetxattr()
1259 op_errno = EINVAL;
1260 goto out;
1261 }
1262
1263 if (inode_ctx->type == SNAP_VIEW_VIRTUAL_INODE) {
1264 size = glfs_fgetxattr (glfd, name, NULL, 0);

CID 1220068:  Missing parentheses  (CONSTANT_EXPRESSION_RESULT)
"!size == -1" is always false regardless of the values of its operands. Did 
you intend to either negate the entire comparison expression, in which case parentheses 
would be required around the entire comparison expression to force that interpretation, 
or negate the sense of the comparison (that is, use '!=' rather than '==')? This occurs 
as the logical operand of if.

1265 if (!size == -1) {
1266 gf_log (this->name, GF_LOG_ERROR, "getxattr on %s 
"
1267 "failed (key: %s)", uuid_utoa 
(fd->inode->gfid),
1268 name);
1269 op_ret = -1;
1270 op_errno = errno;


*** CID 1220067:  Missing parentheses  (CONSTANT_EXPRESSION_RESULT)
/xlators/features/snapview-server/src/snapview-server.c: 1158 in svs_getxattr()
1152 op_errno = EINVAL;
1153 goto out;
1154 } else if (inode_ctx->type == SNAP_VIEW_VIRTUAL_INODE) {
1155 fs = inode_ctx->fs;
1156 object = inode_ctx->object;
1157 size = glfs_h_getxattrs (fs, object, name, NULL, 0);

CID 1220067:  Missing parentheses  (CONSTANT_EXPRESSION_RESULT)
"!size == -1" is always false regardless of the values of its operands. Did 
you intend to either negate the entire comparison expression, in which case parentheses 
would be required around the entire comparison expression to force that interpretation, 
or negate the sense of the comparison (that is, use '!=' rather than '==')? This occurs 
as the logical operand of if.

1158 if (!size == -1) {
1159  

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

2014-05-19 Thread Lalatendu Mohanty


FYI,

Guideline for fixing Coverity issues :
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:   Mon, 19 May 2014 00:10:53 -0700
From:   scan-ad...@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 20 of 29 defect(s)


** CID 1214626:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 12383 in glusterd_recursive_rmdir()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 12383 in glusterd_recursive_rmdir()

** CID 1214625:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 1013 in 
glusterd_get_brick_mount_dir()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 1013 in 
glusterd_get_brick_mount_dir()

** CID 1214624:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 7108 in 
glusterd_get_brick_mount_device()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 7108 in 
glusterd_get_brick_mount_device()

** CID 1214615:  Data race condition  (MISSING_LOCK)
/xlators/storage/posix/src/posix.c: 5662 in init()

** CID 1214616:  Unsigned compared against 0  (NO_EFFECT)
/rpc/rpc-lib/src/rpcsvc.c: 133 in rpcsvc_get_program_vector_sizer()

** CID 1214618:  Dereference null return value  (NULL_RETURNS)
/xlators/storage/posix/src/posix.c: 3119 in posix_links_in_same_directory()

** CID 1214617:  Dereference null return value  (NULL_RETURNS)
/api/src/glfs-mgmt.c: 380 in glfs_get_volume_info()

** CID 1124684:  Dereference null return value  (NULL_RETURNS)
/libglusterfs/src/syncop.c: 1038 in entry_copy()

** CID 1214608:  Wrong operator used  (CONSTANT_EXPRESSION_RESULT)
/xlators/mgmt/glusterd/src/glusterd-handshake.c: 1081 in 
__server_get_volume_info()

** CID 1214612:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4419 in 
glusterd_snapshot_activate_commit()

** CID 1214611:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4480 in 
glusterd_snapshot_deactivate_commit()

** CID 1214610:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4113 in 
glusterd_snapshot_activate_deactivate_prevalidate()

** CID 1214609:  Logically dead code  (DEADCODE)
/xlators/features/changelog/lib/src/gf-history-changelog.c: 910 in 
gf_history_changelog()

** CID 1214613:  Dereference after null check  (FORWARD_NULL)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 4149 in 
glusterd_snapshot_activate_deactivate_prevalidate()

** CID 1214614:  Overflowed return value  (INTEGER_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 2854 in 
gd_pause_or_resume_gsync()

** CID 1214623:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-handshake.c: 1130 in 
__server_get_volume_info()

** CID 1214622:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-handshake.c: 410 in 
glusterd_create_missed_snap()

** CID 1214621:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 3618 in 
glusterd_take_lvm_snapshot()

** CID 1214620:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-op-sm.c: 3634 in 
glusterd_op_start_rb_timer()

** CID 1214619:  Resource leak  (RESOURCE_LEAK)
/xlators/features/changelog/src/changelog-helpers.c: 313 in htime_open()



*** CID 1214626:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 12383 in glusterd_recursive_rmdir()
12377 if (ret) {
12378 gf_log (this->name, GF_LOG_DEBUG, "Failed to rmdir: 
%s,err: %s",
12379 delete_path, strerror (errno));
12380 }
12381
12382 out:

CID 1214626:  Resource leak  (RESOURCE_LEAK)
Variable "dir" going out of scope leaks the storage it points to.

12383 return ret;
12384 }
12385
12386 gf_boolean_t
12387 glusterd_volume_quorum_calculate (glusterd_volinfo_t *volinfo, dict_t 
*dict,
12388   int down_count, gf_boolean_t 
first_brick_on,
/xlators/mgmt/glusterd/src/glusterd-utils.c: 12383 in glusterd_recursive_rmdir()
12377 if (ret) {
12378 gf_log (this->name, GF_LOG_DEBUG, "Failed to rmdir: 
%s,err: %s",
12379 delete_path, strerror (errno));
12380 }
12381
12382 out:

CID 1214626:  Resource leak  (RESOURCE_LEAK)
Variable "dir" going out of scope leaks the storage it points to.

12383 return ret;
12384 }
12385
12386 gf_boolean_t
12387 glusterd_volume_quorum_calculate (glusterd_volinfo_t *volinfo, dict_t 
*dict,
12388   int down_count, gf_boolea

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

2014-05-02 Thread Lalatendu Mohanty

FYI,

Guideline for fixing Coverity issues :
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:   Thu, 01 May 2014 23:43:17 -0700
From:   scan-ad...@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 20 of 24 defect(s)


** CID 1210972:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/libglusterfs/src/dict.c: 2218 in dict_set_static_bin()

** CID 1210971:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/libglusterfs/src/dict.c: 2188 in dict_set_bin()

** CID 1210970:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/xlators/protocol/server/src/server-helpers.c: 748 in serialize_rsp_direntp()

** CID 1210969:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/xlators/protocol/server/src/server-handshake.c: 649 in server_setvolume()

** CID 1210977:  Logically dead code  (DEADCODE)
/cli/src/cli-rpc-ops.c: 8693 in gf_cli_barrier_volume_cbk()

** CID 1210976:  Logically dead code  (DEADCODE)
/xlators/features/changelog/src/changelog.c: 1753 in changelog_pthread_init()

** CID 1210975:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-store.c: 2916 in 
glusterd_mount_brick_paths()

** CID 1210974:  Logically dead code  (DEADCODE)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 5049 in 
glusterd_import_friend_snap()

** CID 1210973:  Logically dead code  (DEADCODE)
/rpc/rpc-lib/src/rpc-clnt-ping.c: 186 in rpc_clnt_ping()

** CID 1210978:  Explicit null dereferenced  (FORWARD_NULL)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 4220 in 
glusterd_delete_stale_volume()

** CID 1210979:  Overflowed return value  (INTEGER_OVERFLOW)
/xlators/mgmt/glusterd/src/glusterd-geo-rep.c: 2661 in stop_gsync()

** CID 1210981:  Missing unlock  (LOCK)
/xlators/features/changelog/src/changelog-helpers.c: 973 in 
changelog_dec_fop_cnt()
/xlators/features/changelog/src/changelog-helpers.c: 973 in 
changelog_dec_fop_cnt()

** CID 1210980:  Missing unlock  (LOCK)
/xlators/features/changelog/src/changelog-helpers.c: 212 in 
changelog_rollover_changelog()

** CID 1210982:  Unsigned compared against 0  (NO_EFFECT)
/glusterfsd/src/glusterfsd.c: 1121 in parse_opts()

** CID 1210988:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-snapshot.c: 285 in 
snap_max_limits_display_commit()

** CID 1210987:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11987 in 
glusterd_restore_geo_rep_files()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11987 in 
glusterd_restore_geo_rep_files()

** CID 1210986:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11679 in glusterd_copy_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11679 in glusterd_copy_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11679 in glusterd_copy_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11679 in glusterd_copy_file()

** CID 1210985:  Resource leak  (RESOURCE_LEAK)
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11679 in glusterd_copy_file()
/xlators/mgmt/glusterd/src/glusterd-utils.c: 11679 in glusterd_copy_file()

** CID 1210984:  Resource leak  (RESOURCE_LEAK)
/xlators/features/mac-compat/src/mac-compat.c: 134 in maccomp_getxattr()

** CID 1210983:  Resource leak  (RESOURCE_LEAK)
/xlators/features/marker/src/marker-quota.c: 397 in mq_update_size_xattr()



*** CID 1210972:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/libglusterfs/src/dict.c: 2218 in dict_set_static_bin()
2212 int
2213 dict_set_static_bin (dict_t *this, char *key, void *ptr, size_t size)
2214 {
2215 data_t * data = NULL;
2216 int  ret  = 0;
2217

CID 1210972:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
"size > 18446744073709551615UL /* 9223372036854775807L * 2UL + 1UL */" is 
always false regardless of the values of its operands. This occurs as the logical second 
operand of '||'.

2218 if (!ptr || (size > ULONG_MAX)) {
2219 ret = -EINVAL;
2220 goto err;
2221 }

2223 data = bin_to_data (ptr, size);


*** CID 1210971:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/libglusterfs/src/dict.c: 2188 in dict_set_bin()
2182 int
2183 dict_set_bin (dict_t *this, char *key, void *ptr, size_t size)
2184 {
2185 data_t * data = NULL;
2186 int  ret  = 0;
2187

CID 1210971:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
"size > 18446744073709551