ARM: KVM: fix warning in mmu.c
Compiling with THP enabled leads to the following warning: arch/arm/kvm/mmu.c: In function ‘unmap_range’: arch/arm/kvm/mmu.c:177:39: warning: ‘pte’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (kvm_pmd_huge(*pmd) || page_empty(pte)) { ^ Code inspection reveals that these two cases are mutually exclusive, so GCC is a bit overzealous here. Silence it anyway by initializing pte to NULL and testing it later on. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
This commit is contained in:
parent
8034699a42
commit
56041bf920
1 changed files with 2 additions and 1 deletions
|
@ -144,6 +144,7 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
|
||||||
while (addr < end) {
|
while (addr < end) {
|
||||||
pgd = pgdp + pgd_index(addr);
|
pgd = pgdp + pgd_index(addr);
|
||||||
pud = pud_offset(pgd, addr);
|
pud = pud_offset(pgd, addr);
|
||||||
|
pte = NULL;
|
||||||
if (pud_none(*pud)) {
|
if (pud_none(*pud)) {
|
||||||
addr = kvm_pud_addr_end(addr, end);
|
addr = kvm_pud_addr_end(addr, end);
|
||||||
continue;
|
continue;
|
||||||
|
@ -174,7 +175,7 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
|
||||||
/*
|
/*
|
||||||
* If the pmd entry is to be cleared, walk back up the ladder
|
* If the pmd entry is to be cleared, walk back up the ladder
|
||||||
*/
|
*/
|
||||||
if (kvm_pmd_huge(*pmd) || page_empty(pte)) {
|
if (kvm_pmd_huge(*pmd) || (pte && page_empty(pte))) {
|
||||||
clear_pmd_entry(kvm, pmd, addr);
|
clear_pmd_entry(kvm, pmd, addr);
|
||||||
next = kvm_pmd_addr_end(addr, end);
|
next = kvm_pmd_addr_end(addr, end);
|
||||||
if (page_empty(pmd) && !page_empty(pud)) {
|
if (page_empty(pmd) && !page_empty(pud)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue