Skip to contentSkip to conversation

kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c

PATCH In review Nicholas Krause 4 participants 4 messages Aug 10, 2015 – Aug 20, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c

This fixes the wrapper functions kvm_umap_hva_hv and the function kvm_unmap_hav_range_hv to return the return value of the function kvm_handle_hva or kvm_handle_hva_range that they are wrapped to call internally rather then always making the caller of these wrapper functions think they always run successfully by returning the value of zero directly.

---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_hv.c +2 -4
index dab68b7..0905c8f 100644
@@ -774,14 +774,12 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
 
 int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva)
 {
-	kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
 }
 
 int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
 {
-	kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
 }
 
 void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
Signature · 6 lines
2.1.4

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
#1 lore raw
Quoted 8 lines · Nicholas Krause

This fixes the wrapper functions kvm_umap_hva_hv and the function kvm_unmap_hav_range_hv to return the return value of the function kvm_handle_hva or kvm_handle_hva_range that they are wrapped to call internally rather then always making the caller of these wrapper functions think they always run successfully by returning the value of zero directly.

Paul, could you please take on this one?

Thanks,

Alex

Quoted 26 lines
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_hv.c +2 -4
index dab68b7..0905c8f 100644
@@ -774,14 +774,12 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
 
 int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva)
 {
-	kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
 }
 
 int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
 {
-	kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
 }
 
 void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
#2 lore raw
Quoted 9 lines · Alexander Graf
Quoted 7 lines · Nicholas Krause

This fixes the wrapper functions kvm_umap_hva_hv and the function kvm_unmap_hav_range_hv to return the return value of the function kvm_handle_hva or kvm_handle_hva_range that they are wrapped to call internally rather then always making the caller of these wrapper functions think they always run successfully by returning the value of zero directly.

Quoted 3 lines
Quoted 1 line

Paul, could you please take on this one?

Paul's away for a while can you take it directly?

cheers

#3 lore raw
In reply to Nicholas Krause
Quoted 6 lines · Nicholas Krause

This fixes the wrapper functions kvm_umap_hva_hv and the function kvm_unmap_hav_range_hv to return the return value of the function kvm_handle_hva or kvm_handle_hva_range that they are wrapped to call internally rather then always making the caller of these wrapper functions think they always run successfully by returning the value of zero directly.

In fact these functions do always run successfully, and there is no bug fixed here (see below).

I don't object to the change per se, since it reduces the code size very slightly, but the commit message and headline needs to be reworded to avoid giving the impression that this fixes something.

arch/powerpc/kvm/book3s_64_mmu_hv.c static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, · line 782

Quoted 12 lines

int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva) {

arch/powerpc/kvm/book3s_64_mmu_hv.c +2 -4
-	kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
 }
 
 int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
 {
-	kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);

kvm_handle_hva and kvm_handle_hva_range call the handler function (kvm_unmap_rmapp in this case) one or more times, and return the logical OR of the return values from the handler. Since kvm_unmap_rmapp always returns 0, the return value from kvm_handle_hva{,_range} will always be 0 here.

Paul.