diff options
author | Paul Mackerras <paulus@ozlabs.org> | 2017-05-11 11:33:30 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2017-05-12 15:09:03 +1000 |
commit | 67325e988faea735d663799b6d152b5f4254093c (patch) | |
tree | 6048d948f4ac3b3fc00166db17c62dc3d84d6b67 /arch/m32r | |
parent | acde25726bc6034b628febb8a4c6c0838736ccbf (diff) | |
download | linux-stable-67325e988faea735d663799b6d152b5f4254093c.tar.gz linux-stable-67325e988faea735d663799b6d152b5f4254093c.tar.bz2 linux-stable-67325e988faea735d663799b6d152b5f4254093c.zip |
KVM: PPC: Book3S PR: Check copy_to/from_user return values
The PR KVM implementation of the PAPR HPT hypercalls (H_ENTER etc.)
access an image of the HPT in userspace memory using copy_from_user
and copy_to_user. Recently, the declarations of those functions were
annotated to indicate that the return value must be checked. Since
this code doesn't currently check the return value, this causes
compile warnings like the ones shown below, and since on PPC the
default is to compile arch/powerpc with -Werror, this causes the
build to fail.
To fix this, we check the return values, and if non-zero, fail the
hypercall being processed with a H_FUNCTION error return value.
There is really no good error return value to use since PAPR didn't
envisage the possibility that the hypervisor may not be able to access
the guest's HPT, and H_FUNCTION (function not supported) seems as
good as any.
The typical compile warnings look like this:
CC arch/powerpc/kvm/book3s_pr_papr.o
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s_pr_papr.c: In function ‘kvmppc_h_pr_enter’:
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s_pr_papr.c:53:2: error: ignoring return value of ‘copy_from_user’, declared with attribute warn_unused_result [-Werror=unused-result]
copy_from_user(pteg, (void __user *)pteg_addr, sizeof(pteg));
^
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s_pr_papr.c:74:2: error: ignoring return value of ‘copy_to_user’, declared with attribute warn_unused_result [-Werror=unused-result]
copy_to_user((void __user *)pteg_addr, hpte, HPTE_SIZE);
^
... etc.
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/m32r')
0 files changed, 0 insertions, 0 deletions