From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Hogan Subject: Re: [PATCH v2] KVM: MIPS: Fix maybe-uninitialized build failure Date: Tue, 20 Jun 2017 15:54:32 +0100 Message-ID: <20170620145432.GV6973@jhogan-linux.le.imgtec.org> References: <20170620095751.5443-1-James.Cowgill@imgtec.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="32KBALpRDK42x9o9" Cc: Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Ralf Baechle , , To: James Cowgill Return-path: Received: from mailapp01.imgtec.com ([195.59.15.196]:62885 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751038AbdFTOye (ORCPT ); Tue, 20 Jun 2017 10:54:34 -0400 Content-Disposition: inline In-Reply-To: <20170620095751.5443-1-James.Cowgill@imgtec.com> Sender: kvm-owner@vger.kernel.org List-ID: --32KBALpRDK42x9o9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 20, 2017 at 10:57:51AM +0100, James Cowgill wrote: > This commit fixes a "maybe-uninitialized" build failure in > arch/mips/kvm/tlb.c when KVM, DYNAMIC_DEBUG and JUMP_LABEL are all > enabled. The failure is: >=20 > In file included from ./include/linux/printk.h:329:0, > from ./include/linux/kernel.h:13, > from ./include/asm-generic/bug.h:15, > from ./arch/mips/include/asm/bug.h:41, > from ./include/linux/bug.h:4, > from ./include/linux/thread_info.h:11, > from ./include/asm-generic/current.h:4, > from ./arch/mips/include/generated/asm/current.h:1, > from ./include/linux/sched.h:11, > from arch/mips/kvm/tlb.c:13: > arch/mips/kvm/tlb.c: In function =E2=80=98kvm_mips_host_tlb_inv=E2=80=99: > ./include/linux/dynamic_debug.h:126:3: error: =E2=80=98idx_kernel=E2=80= =99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitializ= ed] > __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ > ^~~~~~~~~~~~~~~~~~ > arch/mips/kvm/tlb.c:169:16: note: =E2=80=98idx_kernel=E2=80=99 was declar= ed here > int idx_user, idx_kernel; > ^~~~~~~~~~ >=20 > There is a similar error relating to "idx_user". Both errors were > observed with GCC 6. >=20 > As far as I can tell, it is impossible for either idx_user or idx_kernel > to be uninitialized when they are later read in the calls to kvm_debug, > but to satisfy the compiler, add zero initializers to both variables. >=20 > Signed-off-by: James Cowgill > Fixes: 57e3869cfaae ("KVM: MIPS/TLB: Generalise host TLB invalidate to ke= rnel ASID") > Cc: # 4.11+ Acked-by: James Hogan Paolo / Radim: is it okay for one of you to pick this one up for 4.12? Thanks James > --- > arch/mips/kvm/tlb.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c > index 7c6336dd2638..7cd92166a0b9 100644 > --- a/arch/mips/kvm/tlb.c > +++ b/arch/mips/kvm/tlb.c > @@ -166,7 +166,11 @@ static int _kvm_mips_host_tlb_inv(unsigned long entr= yhi) > int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long va, > bool user, bool kernel) > { > - int idx_user, idx_kernel; > + /* > + * Initialize idx_user and idx_kernel to workaround bogus > + * maybe-initialized warning when using GCC 6. > + */ > + int idx_user =3D 0, idx_kernel =3D 0; > unsigned long flags, old_entryhi; > =20 > local_irq_save(flags); > --=20 > 2.11.0 >=20 --32KBALpRDK42x9o9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAllJNx4ACgkQbAtpk944 dnr6Pg/9HWh09LB9ENpF+7CTVyQ/tVBMaDe3o5DxHrR41jMgbyqMDrgaJz9Fpons Jz9limbEqeUh2c6wXQ0AJl/z5PQmNJqoeiNPWrpckq1SwfiWwkder7Z8KaxfJxeg AspKaZBmg/N/tvcDXK3dzkgAdm/acts/lN1BUTAShjiCTNGooaJdqCu1difo+h7D tH0F9fYR5MQTLoZjStViI/tdHo9P0Y7zBWnBvOJn6ghVMb7K39hlDhT9E0AJ/dwD 0r92SlpiXu4QukmvWuKZIFYCB4H8unMvGSFi7L/CMz4/qhtgVkepsBBONvMddvXJ x9JJ26cn7gc79wotnKw3vEIJhzcRChrsfGVet6J0Cc8Fl93M80QaE3h0h6J7msTp kwsOikcyGHlMhnReOTeclw3dNJr/9l3+gjqPAQlZkj/OLOYJptTz7s+LxtUDDJaI Ikmvsmz1/sO1l74mRVPBLp9gmGylCF9sWvNwEEXLvPEhT40Qn5WL3QUJGRxeIrhS FbT2lvHvt5TftdWp85AZiR5hVe1JlSoq2QoUuGSQTnRyTMjmI0FmrMmBXKfs5dlD /uX5Tj2NLOWeP+50UhOUwDVDSoR/7j2NZ+xvuFVxuKzNOn1NuB+4+sBCfAUYJgIi ehRAvI59R7+wMxuhM8i3x4m8XYB+SK5STqWpTCnCdl5wBEcjGrE= =9hU6 -----END PGP SIGNATURE----- --32KBALpRDK42x9o9--