Blame SOURCES/0037-kvm-avoid-bogus-vcpu_info-assignment-in-vcpu_registe.patch

b484ca
From 9446038e9face3313373ca5f7539476789fd4660 Mon Sep 17 00:00:00 2001
b484ca
From: Eugene Syromyatnikov <evgsyr@gmail.com>
b484ca
Date: Tue, 18 Dec 2018 05:37:30 +0100
b484ca
Subject: [PATCH] kvm: avoid bogus vcpu_info assignment in vcpu_register
b484ca
b484ca
Also reformat code a bit to make nesting a bit clearer.
b484ca
b484ca
Reported by Clang.
b484ca
b484ca
* kvm.c (vcpu_register): Do not assign vcpu_alloc result to vcpu_info
b484ca
as this value is not used afterwards in the function.
b484ca
---
b484ca
 kvm.c | 7 +++----
b484ca
 1 file changed, 3 insertions(+), 4 deletions(-)
b484ca
b484ca
diff --git a/kvm.c b/kvm.c
b484ca
index 984a75e..8bdf1cc 100644
b484ca
--- a/kvm.c
b484ca
+++ b/kvm.c
b484ca
@@ -76,10 +76,9 @@ vcpu_register(struct tcb *const tcp, int fd, int cpuid)
b484ca
 
b484ca
 	struct vcpu_info *vcpu_info = vcpu_find(tcp, fd);
b484ca
 
b484ca
-	if (!vcpu_info)
b484ca
-		vcpu_info = vcpu_alloc(tcp, fd, cpuid);
b484ca
-	else if (vcpu_info->cpuid != cpuid)
b484ca
-	{
b484ca
+	if (!vcpu_info) {
b484ca
+		vcpu_alloc(tcp, fd, cpuid);
b484ca
+	} else if (vcpu_info->cpuid != cpuid) {
b484ca
 		vcpu_info->cpuid = cpuid;
b484ca
 		vcpu_info->resolved = false;
b484ca
 	}
b484ca
-- 
b484ca
2.1.4
b484ca