[libvirt] [PATCH] storage: avoid missing break in default branch of switch statement

Detected by Coverity. * src/storage/storage_backend.c: avoid missing break in default branch. https://bugzilla.redhat.com/show_bug.cgi?id=721335 Signed-off-by: Alex Jia <ajia@redhat.com> --- src/storage/storage_backend.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 6243d1e..004bc66 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -819,6 +819,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, virCommandAddArgFormat(cmd, "%lluK", size_arg); if (do_encryption) virCommandAddArg(cmd, "-e"); + break; } } else { virCommandAddArgList(cmd, "create", "-f", type, -- 1.7.1

On 08/08/2011 04:20 AM, Alex Jia wrote:
Detected by Coverity.
* src/storage/storage_backend.c: avoid missing break in default branch.
https://bugzilla.redhat.com/show_bug.cgi?id=721335
Signed-off-by: Alex Jia<ajia@redhat.com> --- src/storage/storage_backend.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 6243d1e..004bc66 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -819,6 +819,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, virCommandAddArgFormat(cmd, "%lluK", size_arg); if (do_encryption) virCommandAddArg(cmd, "-e"); + break; }
NACK. The last label in a switch statement does not need a break, so this can't possibly fix a bug. Can you post the actual Coverity trace that led you to believe this was where it was reporting about? I suspect that this is instead a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=711151. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 08/08/2011 10:04 PM, Eric Blake wrote:
On 08/08/2011 04:20 AM, Alex Jia wrote:
Detected by Coverity.
* src/storage/storage_backend.c: avoid missing break in default branch.
https://bugzilla.redhat.com/show_bug.cgi?id=721335
Signed-off-by: Alex Jia<ajia@redhat.com> --- src/storage/storage_backend.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 6243d1e..004bc66 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -819,6 +819,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, virCommandAddArgFormat(cmd, "%lluK", size_arg); if (do_encryption) virCommandAddArg(cmd, "-e"); + break; }
NACK. The last label in a switch statement does not need a break, so this can't possibly fix a bug. Can you post the actual Coverity trace that led you to believe this was where it was reporting about? I suspect that this is instead a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=711151.
Yeah, I'm cancelling this patch. in fact, this issue has been fixed by Cole Robinson: http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=1ccc16c Thanks Alex
participants (3)
-
ajia@redhat.com
-
Alex Jia
-
Eric Blake