RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 721335 - Defects revealed by Coverity scan
Summary: Defects revealed by Coverity scan
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 711151
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-14 10:39 UTC by Michal Luscon
Modified: 2011-12-06 11:16 UTC (History)
6 users (show)

Fixed In Version: libvirt-0.9.4-rc1-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 11:16:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Michal Luscon 2011-07-14 10:39:01 UTC
Description of problem:

libvirt-0.8.7/src/storage/storage_backend.c:795 - unterminated_case: This case (value 2) is not terminated by a 'break' statement.

libvirt-0.8.7/src/lxc/veth.c:132 - Returning potentially uninitialized value "rc".

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

Additional info:

These defects were probably introduced by Red Hat patches.

Comment 2 Eric Blake 2011-07-14 12:04:35 UTC
(In reply to comment #0)
> Description of problem:
> 
> libvirt-0.8.7/src/storage/storage_backend.c:795 - unterminated_case: This case
> (value 2) is not terminated by a 'break' statement.

Dup of bug 711151.

> 
> libvirt-0.8.7/src/lxc/veth.c:132 - Returning potentially uninitialized value
> "rc".

Fixed by upstream commit:

commit c59176c109457161861fd883111373410d3b3a66
Author: Daniel P. Berrange <berrange>
Date:   Thu Mar 17 15:54:24 2011 +0000

    Fix uninitialized variable & error reporting in LXC veth setup
    
    THe veth setup in LXC had a couple of flaws, first brInit did
    not report any error when it failed. Second vethCreate() did
    not correctly initialize the variable containing the return
    code, so could report failure even when it succeeded.
    
    * src/lxc/lxc_driver.c: Report error when brInit fails
    * src/lxc/veth.c: Fix uninitialized variable

Comment 7 Alex Jia 2011-08-08 10:00:24 UTC
It seems the above patch hasn't resolved the first issue:
libvirt-0.8.7/src/storage/storage_backend.c:795 - unterminated_case: This case
(value 2) is not terminated by a 'break' statement.

Need to add 'break' into default branch of switch statement followed by virCommandAddArg(cmd, "-e") line to avoid this warning, it looks like this:


 643 static int
 644 virStorageBackendCreateQemuImg(virConnectPtr conn,
 645                                virStoragePoolObjPtr pool,
 646                                virStorageVolDefPtr vol,
 647                                virStorageVolDefPtr inputvol,
 648                                unsigned int flags)
 649 {
 
 ......
 796         switch (imgformat) {
 ......
 814         default:
 815             VIR_INFO("Unable to set backing store format for %s with %s",
 816                      vol->target.path, create_tool);
 817 
 818             virCommandAddArg(cmd, vol->target.path);
 819             virCommandAddArgFormat(cmd, "%lluK", size_arg);
 820             if (do_encryption)
 821                 virCommandAddArg(cmd, "-e");
 822             break;
 823         }

Alex

Comment 8 Alex Jia 2011-08-08 10:09:59 UTC
This patch is used for resolving the first issue:
https://www.redhat.com/archives/libvir-list/2011-August/msg00262.html

Comment 9 Kamil Dudka 2011-08-08 10:16:50 UTC
(In reply to comment #7)
> It seems the above patch hasn't resolved the first issue:
> libvirt-0.8.7/src/storage/storage_backend.c:795 - unterminated_case: This case
> (value 2) is not terminated by a 'break' statement.

You are right.

> Need to add 'break' into default branch of switch statement followed by
> virCommandAddArg(cmd, "-e") line to avoid this warning, it looks like this:

Not really, you need to add 'break' _before_ the default branch.

The defect went away with this upstream commit:

http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=1ccc16c

Comment 10 Kamil Dudka 2011-08-08 10:31:57 UTC
(In reply to comment #8)
> This patch is used for resolving the first issue:
> https://www.redhat.com/archives/libvir-list/2011-August/msg00262.html

There is no point in adding break at the end of a switch.  As far as I understand the fragment of the code, this patch solves nothing.  Where is actually the git repository where the patch landed to?

Comment 11 Alex Jia 2011-08-08 14:06:29 UTC
(In reply to comment #9)
> (In reply to comment #7)
> > It seems the above patch hasn't resolved the first issue:
> > libvirt-0.8.7/src/storage/storage_backend.c:795 - unterminated_case: This case
> > (value 2) is not terminated by a 'break' statement.
> 
> You are right.
> 
> > Need to add 'break' into default branch of switch statement followed by
> > virCommandAddArg(cmd, "-e") line to avoid this warning, it looks like this:
> 
> Not really, you need to add 'break' _before_ the default branch.
> 
> The defect went away with this upstream commit:
> 
> http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=1ccc16c

Yeah, it's my fault, I'm working on latest libvirt git tree, hence I can see 'break' _before_ the default branch.

Alex

Comment 12 Eric Blake 2011-08-08 14:06:41 UTC
Nothing further is needed for this BZ - libvirt 0.9.4-1.el6 should already have all issued patched, per comment 2.

Comment 13 Alex Jia 2011-08-08 14:09:33 UTC
(In reply to comment #10)
> (In reply to comment #8)
> > This patch is used for resolving the first issue:
> > https://www.redhat.com/archives/libvir-list/2011-August/msg00262.html
> 
> There is no point in adding break at the end of a switch.  As far as I
> understand the fragment of the code, this patch solves nothing.  Where is
> actually the git repository where the patch landed to?

Agree, it's not necessary to add break at the end of a switch.

Kamil, thanks for your comments.

Ale

Comment 14 Alex Jia 2011-08-08 14:11:43 UTC
This bug has been fixed based on Comment 2 and Comment 8, so change the bug to VERIFIED status.

Comment 18 Michal Luscon 2011-09-23 09:09:04 UTC
Coverity scan found new added defect in the libvirt package - 

/src/qemu/qemu_process.c:2605 - Assigning: "obj" = 0.
/src/qemu/qemu_process.c:2607 - Passing null variable "obj" to function "virDomainObjIsActive", which dereferences it.

version - libvirt-0.9.4-11.el6

If you would like to have this in new bugzilla entry, please contact me.

Comment 19 Alex Jia 2011-09-23 09:30:41 UTC
(In reply to comment #18)
> Coverity scan found new added defect in the libvirt package - 

Hi Michal,
This issue has been fixed on libvirt upstream, and we have a bug to trace some issues are raised by Coverity: 

Patch for upstream:
https://www.redhat.com/archives/libvir-list/2011-September/msg00859.html

Bug tracing:
https://bugzilla.redhat.com/show_bug.cgi?id=739704


Thanks,
Alex

Comment 20 errata-xmlrpc 2011-12-06 11:16:30 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.

http://rhn.redhat.com/errata/RHBA-2011-1513.html


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