Skip to content

Commit 9f9eae5

Browse files
malaterrempe
authored andcommitted
powerpc/kvm: Prefer fault_in_pages_readable function
Directly use fault_in_pages_readable instead of manual __get_user code. Fix warning treated as error with W=1: arch/powerpc/kernel/kvm.c:675:6: error: variable ‘tmp’ set but not used [-Werror=unused-but-set-variable] Suggested-by: Christophe Leroy <[email protected]> Signed-off-by: Mathieu Malaterre <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 0078778 commit 9f9eae5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/kernel/kvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/kvm_para.h>
2626
#include <linux/slab.h>
2727
#include <linux/of.h>
28+
#include <linux/pagemap.h>
2829

2930
#include <asm/reg.h>
3031
#include <asm/sections.h>
@@ -672,14 +673,13 @@ static void kvm_use_magic_page(void)
672673
{
673674
u32 *p;
674675
u32 *start, *end;
675-
u32 tmp;
676676
u32 features;
677677

678678
/* Tell the host to map the magic page to -4096 on all CPUs */
679679
on_each_cpu(kvm_map_magic_page, &features, 1);
680680

681681
/* Quick self-test to see if the mapping works */
682-
if (__get_user(tmp, (u32*)KVM_MAGIC_PAGE)) {
682+
if (!fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) {
683683
kvm_patching_worked = false;
684684
return;
685685
}

0 commit comments

Comments
 (0)