lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211206164503.135917-1-amhamza.mgc@gmail.com>
Date:   Mon,  6 Dec 2021 21:45:03 +0500
From:   Ameer Hamza <amhamza.mgc@...il.com>
To:     vkuznets@...hat.com
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        pbonzini@...hat.com, seanjc@...gle.com, wanpengli@...cent.com,
        jmattson@...gle.com, joro@...tes.org, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
        x86@...nel.org, hpa@...or.com, Ameer Hamza <amhamza.mgc@...il.com>
Subject: [PATCH v3] KVM: x86: fix for missing initialization of return status variable

If undefined ioctl number is passed to the kvm_vcpu_ioctl_device_attr
ioctl, we should trigger KVM_BUG_ON() and return with EIO to silent
coverity warning.

Addresses-Coverity: 1494124 ("Uninitialized scalar variable")
Signed-off-by: Ameer Hamza <amhamza.mgc@...il.com>
---
Changes in v3:
Added KVM_BUG_ON() as default case and returned -EIO
---
 arch/x86/kvm/x86.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e0aa4dd53c7f..b37068f847ff 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5019,6 +5019,9 @@ static int kvm_vcpu_ioctl_device_attr(struct kvm_vcpu *vcpu,
 	case KVM_SET_DEVICE_ATTR:
 		r = kvm_arch_tsc_set_attr(vcpu, &attr);
 		break;
+	default:
+		KVM_BUG_ON(1, vcpu->kvm);
+		r = -EIO;
 	}
 
 	return r;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ