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