qemu-kvm/kvm-qemu-img-remove-unused-variable.patch
Miroslav Rezanina e961a3354a * Mon Nov 14 2022 Miroslav Rezanina <mrezanin@redhat.com> - 7.1.0-5
- kvm-rtl8139-Remove-unused-variable.patch [bz#2141218]
- kvm-qemu-img-remove-unused-variable.patch [bz#2141218]
- kvm-host-libusb-Remove-unused-variable.patch [bz#2141218]
- Resolves: bz#2141218
  (qemu-kvm build fails with clang 15.0.1 due to false unused variable error)
2022-11-14 03:29:01 -05:00

46 lines
1.5 KiB
Diff

From 2458bcc8497fb12ad81e9fd5d05a6164d25f00d6 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 9 Nov 2022 05:12:46 -0500
Subject: [PATCH 2/3] qemu-img: remove unused variable
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
RH-MergeRequest: 122: Remove variables causing 'Unused but set variable' warning on Clang 15
RH-Bugzilla: 2141218
RH-Commit: [2/3] 9cd54891567781090accfb68aa5d80d2c6d68584 (mrezanin/centos-src-qemu-kvm)
Variable block_count used in img_dd function is only incremented but never read.
This causes 'Unused but set variable' warning on Clang 15.0.1 compiler.
Removing the variable to prevent the warning.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
qemu-img.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 7d4b33b3da..987da256ef 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -4919,7 +4919,7 @@ static int img_dd(int argc, char **argv)
const char *out_fmt = "raw";
const char *fmt = NULL;
int64_t size = 0;
- int64_t block_count = 0, out_pos, in_pos;
+ int64_t out_pos, in_pos;
bool force_share = false;
struct DdInfo dd = {
.flags = 0,
@@ -5119,7 +5119,7 @@ static int img_dd(int argc, char **argv)
in.buf = g_new(uint8_t, in.bsz);
- for (out_pos = 0; in_pos < size; block_count++) {
+ for (out_pos = 0; in_pos < size; ) {
int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
ret = blk_pread(blk1, in_pos, bytes, in.buf, 0);
--
2.31.1