Bug 1315009 - glusterd: coverity warning in glusterd-snapshot-utils.c copy_nfs_ganesha_file()
glusterd: coverity warning in glusterd-snapshot-utils.c copy_nfs_ganesha_file()
Status: CLOSED CURRENTRELEASE
Product: GlusterFS
Classification: Community
Component: glusterd (Show other bugs)
3.7.8
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kaleb KEITHLEY
: Triaged
Depends On: 1310755
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-05 11:09 EST by Kaleb KEITHLEY
Modified: 2016-04-19 03:21 EDT (History)
1 user (show)

See Also:
Fixed In Version: glusterfs-3.7.9
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1310755
Environment:
Last Closed: 2016-04-08 07:24:17 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kaleb KEITHLEY 2016-03-05 11:09:55 EST
+++ This bug was initially created as a clone of Bug #1310755 +++

Description of problem:

coverity warning

Version-Release number of selected component (if applicable):

mainline, 3.7.x

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:



> ** CID 1351702:  Code maintainability issues  (UNUSED_VALUE)
> /data/workspace/gluster/glusterfs/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c: 3695 in glusterd_copy_nfs_ganesha_file()
>
>
> ________________________________________________________________________________________________________
> *** CID 1351702:  Code maintainability issues  (UNUSED_VALUE)
> /data/workspace/gluster/glusterfs/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c: 3695 in glusterd_copy_nfs_ganesha_file()
> 3689     
> 3690             GF_VALIDATE_OR_GOTO (this->name, src_vol, out);
> 3691             GF_VALIDATE_OR_GOTO (this->name, dest_vol, out);
> 3692     
> 3693             if (src_vol->is_snap_volume) {
> 3694                     GLUSTERD_GET_SNAP_DIR (snap_dir, src_vol->snapshot, priv);
>>>>     CID 1351702:  Code maintainability issues  (UNUSED_VALUE)
>>>>     Assigning value from "snprintf(src_path, 4096UL, "%s/export.%s.conf", snap_dir, src_vol->snapshot->snapname)" to "ret" here, but that stored value is overwritten before it can be used.
> 3695                     ret = snprintf (src_path, sizeof (src_path),
> 3696                                     "%s/export.%s.conf", snap_dir,
> 3697                                     src_vol->snapshot->snapname);
> 3698             } else {
> 3699                     ret = snprintf (src_path, sizeof (src_path),
> 3700                                     "%s/export.%s.conf", GANESHA_EXPORT_DIRECTORY,

...

--- Additional comment from Vijay Bellur on 2016-02-22 11:06:38 EST ---

REVIEW: http://review.gluster.org/13486 (glusterd: coverity warning in glusted_copy_nfs_ganesha_file()) posted (#1) for review on master by Kaleb KEITHLEY (kkeithle@redhat.com)

--- Additional comment from Vijay Bellur on 2016-02-22 13:14:37 EST ---

REVIEW: http://review.gluster.org/13486 (glusterd: coverity warning in glusted_copy_nfs_ganesha_file()) posted (#2) for review on master by Kaleb KEITHLEY (kkeithle@redhat.com)

--- Additional comment from Vijay Bellur on 2016-02-23 11:45:03 EST ---

COMMIT: http://review.gluster.org/13486 committed in master by Kaleb KEITHLEY (kkeithle@redhat.com) 
------
commit ec6eb8200e41dadc623fd2341a3c5cf8cc71dec7
Author: Kaleb S KEITHLEY <kkeithle@redhat.com>
Date:   Mon Feb 22 11:02:31 2016 -0500

    glusterd: coverity warning in glusted_copy_nfs_ganesha_file()
    
    fix unused return value from snprintf.
    
    Also minor cleanup, including safe handling of truncated output by
    snprintf.
    
    Change-Id: Ibec8c7e6cc4ef07b6535d01a0719359fa3ef8030
    BUG: 1310755
    Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com>
    Reviewed-on: http://review.gluster.org/13486
    Smoke: Gluster Build System <jenkins@build.gluster.com>
    NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
    CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Niels de Vos <ndevos@redhat.com>
Comment 1 Vijay Bellur 2016-03-05 11:42:33 EST
REVIEW: http://review.gluster.org/13612 (glusterd: coverity warning in gluster_copy_nfs_ganesha_file()) posted (#1) for review on release-3.7 by Kaleb KEITHLEY (kkeithle@redhat.com)
Comment 2 Vijay Bellur 2016-03-05 18:51:00 EST
COMMIT: http://review.gluster.org/13612 committed in release-3.7 by Vijay Bellur (vbellur@redhat.com) 
------
commit e1187f011855606c3210a75267847aa29b99584e
Author: Kaleb S KEITHLEY <kkeithle@redhat.com>
Date:   Sat Mar 5 11:36:49 2016 -0500

    glusterd: coverity warning in gluster_copy_nfs_ganesha_file()
    
    fix unused return value from snprintf.
    
    Also minor cleanup, including safe handling of truncated output
    by snprintf, and lstat() -> sys_lstat()
    
    backport from mainline:
    >Change-Id: Ibec8c7e6cc4ef07b6535d01a0719359fa3ef8030
    >BUG: 1310755
    >Reviewed-on: http://review.gluster.org/13486
    
    Change-Id: Ic893751c5ce83c85b01c311091f2728d4997e599
    BUG: 1315009
    Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com>
    Reviewed-on: http://review.gluster.org/13612
    Smoke: Gluster Build System <jenkins@build.gluster.com>
    NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
    CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Comment 3 Kaleb KEITHLEY 2016-04-08 07:24:17 EDT
3.7.10
Comment 4 Kaushal 2016-04-19 03:21:58 EDT
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.7.9, please open a new bug report.

glusterfs-3.7.9 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://www.gluster.org/pipermail/gluster-users/2016-March/025922.html
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user

Note You need to log in before you can comment on or make changes to this bug.