Skip to contentSkip to conversation

KVM: Use return value for error print

PATCH Applied Alexander Graf 4 participants 4 messages Jan 27, 2014 – Feb 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: Use return value for error print

Commit 94ccff13 introduced a more verbose failure message and retry operations on KVM VM creation. However, it ended up using a variable for its failure message that hasn't been initialized yet.

Fix it to use the value it meant to set.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -1
index a3fb8de..3f78651 100644
@@ -1427,7 +1427,7 @@ int kvm_init(void)
     } while (ret == -EINTR);
 
     if (ret < 0) {
-        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,
+        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret,
                 strerror(-ret));
 
 #ifdef TARGET_S390X
Signature · 1 line
1.8.1.4
#1 lore raw

+1

Quoted 28 lines · Alexander Graf

Commit 94ccff13 introduced a more verbose failure message and retry operations on KVM VM creation. However, it ended up using a variable for its failure message that hasn't been initialized yet.

Fix it to use the value it meant to set.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -2
index a3fb8de..3f78651 100644
@@ -1427,7 +1427,7 @@ int kvm_init(void)
     } while (ret == -EINTR);
 
     if (ret < 0) {
-        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,
+        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret,
                 strerror(-ret));
 
 #ifdef TARGET_S390X
--

1.8.1.4

#2 lore raw
In reply to Alexander Graf

Quoting Alexander Graf (2014-01-27 08:18:09)

Quoted 7 lines

Commit 94ccff13 introduced a more verbose failure message and retry operations on KVM VM creation. However, it ended up using a variable for its failure message that hasn't been initialized yet.

Fix it to use the value it meant to set.

ping for 1.7.1

Quoted 19 lines
---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -1
index a3fb8de..3f78651 100644
@@ -1427,7 +1427,7 @@ int kvm_init(void)
     } while (ret == -EINTR);
 
     if (ret < 0) {
-        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,
+        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret,
                 strerror(-ret));
 
 #ifdef TARGET_S390X
Signature · 1 line
1.8.1.4
#3 lore raw
In reply to Alexander Graf

Il 27/01/2014 15:18, Alexander Graf ha scritto:

Quoted 17 lines

Commit 94ccff13 introduced a more verbose failure message and retry operations on KVM VM creation. However, it ended up using a variable for its failure message that hasn't been initialized yet.

Fix it to use the value it meant to set.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +0 -0
index a3fb8de..3f78651 100644

kvm-all.c int kvm_init(void) · line 1433

Quoted 8 lines
kvm-all.c +1 -1
@@ -1427,7 +1427,7 @@ int kvm_init(void)
     } while (ret == -EINTR);
 
     if (ret < 0) {
-        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,
+        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret,
                 strerror(-ret));
 
 #ifdef TARGET_S390X

Applied to uq/master, thanks.

Paolo