Commit e0e13614626bfb5a88678fd951d728ed40e3cbf6
Committed by
Benjamin Herrenschmidt
1 parent
2fb10672c8
Exists in
master
and in
20 other branches
powerpc/kvm/book3s_pr: Return appropriate error when allocation fails
err was overwritten by a previous function call, and checked to be 0. If the following page allocation fails, 0 is going to be returned instead of -ENOMEM. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
arch/powerpc/kvm/book3s_pr.c
... | ... | @@ -1047,11 +1047,12 @@ |
1047 | 1047 | if (err) |
1048 | 1048 | goto free_shadow_vcpu; |
1049 | 1049 | |
1050 | + err = -ENOMEM; | |
1050 | 1051 | p = __get_free_page(GFP_KERNEL|__GFP_ZERO); |
1051 | - /* the real shared page fills the last 4k of our page */ | |
1052 | - vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096); | |
1053 | 1052 | if (!p) |
1054 | 1053 | goto uninit_vcpu; |
1054 | + /* the real shared page fills the last 4k of our page */ | |
1055 | + vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096); | |
1055 | 1056 | |
1056 | 1057 | #ifdef CONFIG_PPC_BOOK3S_64 |
1057 | 1058 | /* default to book3s_64 (970fx) */ |