[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v7][RFC][PATCH 07/13] xen/x86/p2m: introduce p2m_check_reserved_device_memory



>>> On 24.10.14 at 09:34, <tiejun.chen@xxxxxxxxx> wrote:
> --- a/xen/include/asm-x86/p2m.h
> +++ b/xen/include/asm-x86/p2m.h
> @@ -713,6 +713,19 @@ extern int arch_grant_map_page_identity(struct domain 
> *d, unsigned long frame,
>                                   bool_t writeable);
>  extern int arch_grant_unmap_page_identity(struct domain *d, unsigned long 
> frame);
>  
> +/* Check if we are accessing rdm. */
> +static inline int p2m_check_reserved_device_memory(xen_pfn_t start,
> +                                                   xen_ulong_t nr, void *d)
> +{
> +    unsigned long *gfn = d;
> +    xen_pfn_t end = start + nr;
> +
> +    if ( *gfn >= start && *gfn <= end )
> +        return 1;
> +
> +    return 0;
> +}

There is absolutely nothing in the function connecting it to its name.
And the last parameter being void looks pretty bogus too. Both
signs of it (again) being wrong to add such a function without at
least one first caller.

Also the way you return from the function suggests the return
type really ought to be bool_t. And instead of the last four lines in
the function body you could again use a single simple return
statement.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.