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

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