From 90fff3ea15a8fa6d2bd60cc0538d8ac33f14b692 Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: Fri, 5 Dec 2014 13:28:04 +0100 Subject: xen: introduce helper functions to do safe read and write accesses Introduce two helper functions to safely read and write unsigned long values from or to memory when the access may fault because the mapping is non-present or read-only. These helpers can be used instead of open coded uses of __get_user() and __put_user() avoiding the need to do casts to fix sparse warnings. Use the helpers in page.h and p2m.c. This will fix the sparse warnings when doing "make C=1". Signed-off-by: Juergen Gross Signed-off-by: David Vrabel --- arch/x86/xen/p2m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86/xen/p2m.c') diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 8b5db51be4dd..edbc7a63fd73 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -625,7 +625,7 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) return true; } - if (likely(!__put_user(mfn, xen_p2m_addr + pfn))) + if (likely(!xen_safe_write_ulong(xen_p2m_addr + pfn, mfn))) return true; ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level); -- cgit v1.2.3