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-next>] [day] [month] [year] [list]
Message-ID: <142668.1440884956@turing-police.cc.vt.edu>
Date:	Sat, 29 Aug 2015 17:49:16 -0400
From:	Valdis Kletnieks <Valdis.Kletnieks@...edu>
To:	Gleb Natapov <gleb@...nel.org>, Paolo Bonzini <pbonzini@...hat.com>
cc:	x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Aruna Hewapathirane <aruna.hewapathirane@...il.com>
Subject: Silence compiler warning in  arch/x86/kvm/emulate.c

Compiler warning:

 CC [M]  arch/x86/kvm/emulate.o
arch/x86/kvm/emulate.c: In function "__do_insn_fetch_bytes":
arch/x86/kvm/emulate.c:814:9: warning: "linear" may be used uninitialized in this function [-Wmaybe-uninitialized]

GCC is smart enough to realize that the inlined __linearize may return before
setting the value of linear, but not smart enough to realize the same
X86EMU_CONTINUE blocks actual use of the value.  However, the value of
'linear' can only be set to one value, so hoisting the one line of code
upwards makes GCC happy with the code.

Reported-by: Aruna Hewapathirane <aruna.hewapathirane@...il.com>
Tested-by: Aruna Hewapathirane <aruna.hewapathirane@...il.com>
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@...edu>

--- a/arch/x86/kvm/emulate.c.dist	2015-08-11 14:10:05.366061993 -0400
+++ b/arch/x86/kvm/emulate.c	2015-08-29 13:43:13.014163958 -0400
@@ -650,6 +650,7 @@ static __always_inline int __linearize(s
 	u16 sel;
 
 	la = seg_base(ctxt, addr.seg) + addr.ea;
+	*linear = la;
 	*max_size = 0;
 	switch (mode) {
 	case X86EMUL_MODE_PROT64:
@@ -693,7 +694,6 @@ static __always_inline int __linearize(s
 	}
 	if (insn_aligned(ctxt, size) && ((la & (size - 1)) != 0))
 		return emulate_gp(ctxt, 0);
-	*linear = la;
 	return X86EMUL_CONTINUE;
 bad:
 	if (addr.seg == VCPU_SREG_SS)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ