Bug 825903

Summary: Coverity scan relevant defects
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Alex Jia <ajia>
Status: CLOSED UPSTREAM QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, dallan, dyasny, dyuan, mzhan, rwu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-10 02:42:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
CoverityScan on libvirt-0.9.10-21.el6.x86_64
none
CoverityScan on libvirt-0.10.0-0rc0.el6.src.rpm none

Description Alex Jia 2012-05-29 03:13:50 UTC
Created attachment 587302 [details]
CoverityScan on libvirt-0.9.10-21.el6.x86_64

Description of problem:
The bug is used for tracking CoverityScan relevant issues for 6.4 like 6.3.

Version-Release number of selected component (if applicable):
# rpm -q libvirt
libvirt-0.9.10-21.el6.x86_64


How reproducible:
always

Steps to Reproduce:
1.
2.
3.
  
Actual results:
CoverityScan on libvirt-0.9.10-21.el6.x86_64:

Analysis summary report:
------------------------
Files analyzed                 : 249
Total LoC input to cov-analyze : 310106
Functions analyzed             : 7587
Paths analyzed                 : 868953
Defect occurrences found       : 43 Total
                                  6 CHECKED_RETURN
                                 13 DEADCODE
                                  1 EVALUATION_ORDER
                                  1 FORWARD_NULL
                                  1 MISSING_RETURN
                                  2 NEGATIVE_RETURNS
                                  1 NO_EFFECT
                                  3 NULL_RETURNS
                                  1 OVERRUN_STATIC
                                  7 RESOURCE_LEAK
                                  1 RETURN_LOCAL
                                  1 SIZEOF_MISMATCH
                                  3 UNINIT
                                  2 UNUSED_VALUE

Expected results:


Additional info:

Comment 2 Dave Allan 2012-05-29 16:00:28 UTC
Alex, would it be possible for you to file BZs for the specific problems reported by Coverity instead of a single BZ for the entire report?

Comment 3 Alex Jia 2012-05-30 02:21:07 UTC
(In reply to comment #2)
> Alex, would it be possible for you to file BZs for the specific problems
> reported by Coverity instead of a single BZ for the entire report?

Yeah, I'm analysing test report then will pick up some critical issues in here later.

Comment 4 Alex Jia 2012-05-30 10:40:34 UTC
Need to confirm the following issues:

1.
Error: OVERRUN_STATIC:
/builddir/build/BUILD/libvirt-0.9.10/src/locking/lock_driver_sanlock.c:158: overrun-buffer-arg: Overrunning static array ""__LIBVIRT__DISKS__"" of size 19 bytes by passing it to a function which indexes it with argument "48UL" at byte position 47.

2.
Error: SIZEOF_MISMATCH:
/builddir/build/BUILD/libvirt-0.9.10/tools/virsh.c:5316: suspicious_sizeof: Passing argument "8UL /* sizeof (cpumap) */" to function "_vshCalloc" and then casting the return value to "unsigned char *" is suspicious.

3.
Error: UNINIT:
/builddir/build/BUILD/libvirt-0.9.10/src/lxc/lxc_driver.c:1395: var_decl: Declaring variable "fd" without initializer.
/builddir/build/BUILD/libvirt-0.9.10/src/lxc/lxc_driver.c:1443: uninit_use_in_call: Using uninitialized value "fd" when calling "virFileClose".
/builddir/build/BUILD/libvirt-0.9.10/src/util/virfile.c:50: read_parm: Reading a parameter value.

4.
Error: UNINIT:
/builddir/build/BUILD/libvirt-0.9.10/src/lxc/lxc_controller.c:1104: var_decl: Declaring variable "consoles" without initializer.
/builddir/build/BUILD/libvirt-0.9.10/src/lxc/lxc_controller.c:1237: uninit_use: Using uninitialized value "consoles".

Notes, upstream commit f74471de has fixed issue 3 and 4.

For memory leaks and NULL pointer derefing, they should be okay for libvirt.

In addition, I want to open the bug until rhel6.4 release then trace all of Coverity issues into the bug.

Alex

Comment 6 RHEL Program Management 2012-07-10 07:23:13 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 7 RHEL Program Management 2012-07-10 23:51:35 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 12 Alex Jia 2012-08-06 05:13:36 UTC
Coverity scan on libvirt-0.10.0-0rc0:

Analysis summary report:
------------------------
Files analyzed                 : 274
Total LoC input to cov-analyze : 320606
Functions analyzed             : 7882
Paths analyzed                 : 860037
Defect occurrences found       : 38 Total
                                  3 CHECKED_RETURN
                                  6 DEADCODE
                                  6 FORWARD_NULL
                                  2 MISSING_RETURN
                                  3 NEGATIVE_RETURNS
                                  3 NO_EFFECT
                                  1 NULL_RETURNS
                                  1 OVERRUN_STATIC
                                  5 RESOURCE_LEAK
                                  1 RETURN_LOCAL
                                  1 REVERSE_INULL
                                  1 SIZEOF_MISMATCH
                                  3 UNINIT
                                  2 UNUSED_VALUE

For details, please check attachment.

Comment 13 Alex Jia 2012-08-06 05:15:29 UTC
Created attachment 602408 [details]
CoverityScan on libvirt-0.10.0-0rc0.el6.src.rpm

Comment 14 Dave Allan 2012-08-06 15:01:13 UTC
*** Bug 771022 has been marked as a duplicate of this bug. ***

Comment 15 Dave Allan 2012-10-10 01:48:26 UTC
Alex, I'd like to close this BZ and open new BZs for any specific leaks that need to be fixed in 6.4.  Is that ok with you?

Comment 16 Alex Jia 2012-10-10 02:40:19 UTC
(In reply to comment #15)
> Alex, I'd like to close this BZ and open new BZs for any specific leaks that
> need to be fixed in 6.4.  Is that ok with you?

Dave, it's okay for me.

Comment 17 Dave Allan 2012-10-10 02:42:30 UTC
Ok, thanks.