From: "Jan Beulich" Subject: Re: [PATCH 1/3] x86/mem_access: Make the mem_access ops generic Date: Fri, 11 Apr 2014 11:04:25 +0100 Message-ID: <5347DA490200007800007EA7@nat28.tlf.novell.com> References: <1397188179-14606-1-git-send-email-aravindp@cisco.com> <1397188179-14606-2-git-send-email-aravindp@cisco.com> <5347B769.5040106@citrix.com> <5347D67E0200007800007E8B@nat28.tlf.novell.com> <5347BB8E.4090201@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WYYJu-0002CH-V0 for xen-devel@lists.xenproject.org; Fri, 11 Apr 2014 10:04:27 +0000 In-Reply-To: <5347BB8E.4090201@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel@lists.xenproject.org, Tim Deegan , Keir Fraser , Aravindh Puthiyaparambil List-Id: xen-devel@lists.xenproject.org >>> On 11.04.14 at 11:53, wrote: > On 11/04/14 10:48, Jan Beulich wrote: >>>>> On 11.04.14 at 11:35, wrote: >>> On 11/04/14 04:49, Aravindh Puthiyaparambil wrote: >>>> --- a/xen/arch/x86/mm/mem_access.c >>>> +++ b/xen/arch/x86/mm/mem_access.c >>>> @@ -21,31 +21,98 @@ >>>> */ >>>> >>>> >>>> +#include >>>> +#include >>>> +#include >>>> #include >>>> #include >>>> +#include >>>> >>>> >>>> -int mem_access_memop(struct domain *d, xen_mem_event_op_t *meo) >>>> +#define ACCESS_op_mask 0xff >>>> + >>>> +int mem_access_memop(XEN_GUEST_HANDLE_PARAM(void) arg, unsigned long >>> start_iter) >>>> { >>>> - int rc; >>>> + long rc; >>> int function and long rc? The function wants promoting to long. >> No, what makes it out of the function fits in an "int", > > Why does that matter? It is a recipe for accidental truncation with > future changes (and certainly not the first example in Xen). > > All hypercall handlers should be returning longs, and leaving it to the > compat layer to apply correct truncation if needed. For top level hypercall handlers I agree, but for helper functions like this one I don't. Jan