linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: fix for missing initialization of return status variable
@ 2021-12-05 19:47 Ameer Hamza
  2021-12-06  9:06 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 11+ messages in thread
From: Ameer Hamza @ 2021-12-05 19:47 UTC (permalink / raw)
  To: pbonzini, seanjc, vkuznets, wanpengli, jmattson, joro, tglx,
	mingo, bp, dave.hansen, x86, hpa
  Cc: kvm, linux-kernel, amhamza.mgc

If undefined ioctl number is passed to the kvm_vcpu_ioctl_device_attr
function, it should return with error status.

Addresses-Coverity: 1494124 ("Uninitialized scalar variable")

Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e0aa4dd53c7f..55b90c185717 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5001,7 +5001,7 @@ static int kvm_vcpu_ioctl_device_attr(struct kvm_vcpu *vcpu,
 				      void __user *argp)
 {
 	struct kvm_device_attr attr;
-	int r;
+	int r = -EINVAL;
 
 	if (copy_from_user(&attr, argp, sizeof(attr)))
 		return -EFAULT;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-06 18:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05 19:47 [PATCH] KVM: x86: fix for missing initialization of return status variable Ameer Hamza
2021-12-06  9:06 ` Vitaly Kuznetsov
2021-12-06  9:32   ` Ameer Hamza
2021-12-06 10:24   ` [PATCH v2] " Ameer Hamza
2021-12-06 15:37     ` Sean Christopherson
2021-12-06 16:08       ` Ameer Hamza
2021-12-06 16:45         ` [PATCH v3] " Ameer Hamza
2021-12-06 17:02           ` Sean Christopherson
2021-12-06 17:27             ` Ameer Hamza
2021-12-06 18:01               ` Sean Christopherson
2021-12-06 18:40                 ` Ameer Hamza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).