Bug 1394235 - gfs2-utils: Fixes for static analysis warnings
Summary: gfs2-utils: Fixes for static analysis warnings
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: cluster
Version: 6.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Andrew Price
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-11 12:58 UTC by Andrew Price
Modified: 2017-03-21 09:26 UTC (History)
5 users (show)

Fixed In Version: cluster-3.0.12.1-84.el6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-21 09:26:48 UTC
Target Upstream Version:


Attachments (Terms of Use)
RHEL6 version of the upstream patch (2.40 KB, patch)
2016-11-15 12:59 UTC, Andrew Price
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0601 0 normal SHIPPED_LIVE cluster bug fix update 2017-03-21 12:26:18 UTC

Description Andrew Price 2016-11-11 12:58:20 UTC
This bz is for valid issues reported by covscan for gfs2-utils and not covered by other bug reports. Just the one to begin with:

http://cov01.lab.eng.brq.redhat.com/covscanhub/waiving/15317/54510/#defect_1057213

1. Defect type: CLANG_WARNING
1. cluster-3.0.12.1/gfs2/fsck/main.c:187:18: warning: The left operand of '==' is a garbage value
#         if (sc.sc_total == sdp->blks_total &&
#             ~~~~~~~~~~~ ^
4. cluster-3.0.12.1/gfs2/fsck/main.c:162:16: note: Left side of '&&' is false
#         if (sdp->gfs1 && !sdp->md.statfs->i_di.di_size) {
#                       ^
7. cluster-3.0.12.1/gfs2/fsck/main.c:169:2: note: Taking false branch
#         if (count == sizeof(struct gfs2_statfs_change))
#         ^
10. cluster-3.0.12.1/gfs2/fsck/main.c:177:2: note: Loop condition is false. Execution continues on line 187
#         for (n = osi_first(&sdp->rgtree); n; n = next) {
#         ^
13. cluster-3.0.12.1/gfs2/fsck/main.c:187:18: note: The left operand of '==' is a garbage value
#         if (sc.sc_total == sdp->blks_total &&
#             ~~~~~~~~~~~ ^
#   185|   
#   186|   	/* See if they match */
#   187|-> 	if (sc.sc_total == sdp->blks_total &&
#   188|   	    sc.sc_free == (sdp->blks_total - sdp->blks_alloced) &&
#   189|   	    sc.sc_dinodes == sdp->dinodes_alloced) {

Upstream fixes this just by initialising sc but a better fix would be to handle the earlier error condition from gfs2_readi() such that the function returns instead of leaving sc to be a garbage value.

Comment 2 Andrew Price 2016-11-15 12:59:08 UTC
Created attachment 1220829 [details]
RHEL6 version of the upstream patch

The RHEL6 version of the patch is slightly larger than upstream as check_statfs() was a void function. I've run it through covscan using the same base as ET and it shows that the issue has been fixed: http://cov01.lab.eng.brq.redhat.com/covscanhub/task/32817/log/fixed.html

Comment 6 Nate Straz 2017-01-23 16:37:49 UTC
Verified source of cluster-3.0.12.1-84.el6 include the attached patch.

Comment 8 errata-xmlrpc 2017-03-21 09:26:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0601.html


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