From patchwork Sat Aug 29 21:49:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Valdis_Kl=C4=93tnieks?= X-Patchwork-Id: 7095781 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 49AD49F358 for ; Sat, 29 Aug 2015 22:45:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EB9220761 for ; Sat, 29 Aug 2015 22:45:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80D952075F for ; Sat, 29 Aug 2015 22:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbbH2Wow (ORCPT ); Sat, 29 Aug 2015 18:44:52 -0400 Received: from outbound.smtp.vt.edu ([198.82.183.121]:48339 "EHLO omr2.cc.vt.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752198AbbH2Wov (ORCPT ); Sat, 29 Aug 2015 18:44:51 -0400 X-Greylist: delayed 3263 seconds by postgrey-1.27 at vger.kernel.org; Sat, 29 Aug 2015 18:44:51 EDT Received: from mr2.cc.vt.edu (mr2.cc.ipv6.vt.edu [IPv6:2001:468:c80:2105:0:212:7ed0:359e]) by omr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id t7TLnMZf006552; Sat, 29 Aug 2015 17:49:22 -0400 Received: from auth1.smtp.vt.edu (auth1.smtp.vt.edu [198.82.161.152] (may be forged)) by mr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id t7TLnHfW030043; Sat, 29 Aug 2015 17:49:22 -0400 Received: from turing-police.cc.vt.edu ([IPv6:2601:5c0:c100:9243:9126:603b:ac8:5a7]) (authenticated bits=0) by auth1.smtp.vt.edu (8.14.4/8.14.4) with ESMTP id t7TLnGKe023895 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 29 Aug 2015 17:49:17 -0400 X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6+dev To: Gleb Natapov , Paolo Bonzini cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Aruna Hewapathirane Subject: Silence compiler warning in arch/x86/kvm/emulate.c From: Valdis Kletnieks Mime-Version: 1.0 Date: Sat, 29 Aug 2015 17:49:16 -0400 Message-ID: <142668.1440884956@turing-police.cc.vt.edu> X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Aruna Hewapathirane Signed-off-by: Valdis Kletnieks --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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)