From: Michael Ellerman Date: Wed, 02 Jan 2019 11:31:49 +0000 Subject: Re: KVM: PPC: Book3S HV: radix: Fix uninitialized var build error Message-Id: <43V85f0wYMz9sBn@ozlabs.org> List-Id: In-Reply-To: <20190101035513.12444-1-mpe@ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Michael Ellerman , linuxppc-dev@ozlabs.org Cc: paulus@samba.org, sjitindarsingh@gmail.com, kvm-ppc@vger.kernel.org On Tue, 2019-01-01 at 03:55:13 UTC, Michael Ellerman wrote: > Old GCCs (4.6.3 at least), aren't able to follow the logic in > __kvmhv_copy_tofrom_guest_radix() and warn that old_pid is used > uninitialized: > > arch/powerpc/kvm/book3s_64_mmu_radix.c:75:3: error: 'old_pid' may be > used uninitialized in this function > > The logic is OK, we only use old_pid if quadrant = 1, and in that > case it has definitely be initialised, eg: > > if (quadrant = 1) { > old_pid = mfspr(SPRN_PID); > ... > if (quadrant = 1 && pid != old_pid) > mtspr(SPRN_PID, old_pid); > > Annotate it to fix the error. > > Signed-off-by: Michael Ellerman Applied to powerpc fixes. https://git.kernel.org/powerpc/c/f460772291f8171988b2b60141a457 cheers