From: "Toralf Förster" <toralf.foerster@gmx.de>
To: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org, x86@kernel.org
Subject: [arch/x86/kvm/x86.c:5699]: (error) Uninitialized variable: param
Date: Sat, 26 Apr 2014 19:16:18 +0200 [thread overview]
Message-ID: <535BE9E2.2070607@gmx.de> (raw)
cppcheck spotted this - and while it has a lot of false positives in its current version,
I do think that the kernel code around that line can be improved:
longmode = is_long_mode(vcpu) && cs_l == 1;
if (!longmode) {
param = ((u64)kvm_register_read(vcpu, VCPU_REGS_RDX) << 32) |
(kvm_register_read(vcpu, VCPU_REGS_RAX) & 0xffffffff);
ingpa = ((u64)kvm_register_read(vcpu, VCPU_REGS_RBX) << 32) |
(kvm_register_read(vcpu, VCPU_REGS_RCX) & 0xffffffff);
outgpa = ((u64)kvm_register_read(vcpu, VCPU_REGS_RDI) << 32) |
(kvm_register_read(vcpu, VCPU_REGS_RSI) & 0xffffffff);
}
#ifdef CONFIG_X86_64
else {
param = kvm_register_read(vcpu, VCPU_REGS_RCX);
ingpa = kvm_register_read(vcpu, VCPU_REGS_RDX);
outgpa = kvm_register_read(vcpu, VCPU_REGS_R8);
}
#endif
code = param & 0xffff;
If CONFIG_X86_64 is not defined then the condition "if (!longmode)" is either superfluous
or lacks an else branch, right ?
--
Toralf
next reply other threads:[~2014-04-26 17:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-26 17:16 Toralf Förster [this message]
2014-04-27 9:53 ` [arch/x86/kvm/x86.c:5699]: (error) Uninitialized variable: param Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=535BE9E2.2070607@gmx.de \
--to=toralf.foerster@gmx.de \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.