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

Re: [Xen-devel] [PATCH for-next] x86/shadow: Use ERR_PTR infrastructure for sh_emulate_map_dest()



>>> On 10.05.17 at 12:42, <andrew.cooper3@xxxxxxxxxx> wrote:
> sh_emulate_map_dest() predates the introduction of the generic ERR_PTR()
> infrasturcture, but take the opportunity to avoid opencoding it.
> 
> The chosen error constants require negating to work with IS_ERR(), but no
> other changes.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
although ...

> --- a/xen/arch/x86/mm/shadow/private.h
> +++ b/xen/arch/x86/mm/shadow/private.h
> @@ -395,10 +395,9 @@ void shadow_unhook_mappings(struct domain *d, mfn_t 
> smfn, int user_only);
>  
>  /* Returns a mapped pointer to write to, or one of the following error
>   * indicators. */
> -#define MAPPING_UNHANDLEABLE ((void *)(unsigned long)X86EMUL_UNHANDLEABLE)
> -#define MAPPING_EXCEPTION    ((void *)(unsigned long)X86EMUL_EXCEPTION)
> -#define MAPPING_SILENT_FAIL  ((void *)(unsigned long)X86EMUL_OKAY)
> -#define sh_emulate_map_dest_failed(rc) ((unsigned long)(rc) <= 3)
> +#define MAPPING_UNHANDLEABLE ERR_PTR(-X86EMUL_UNHANDLEABLE)
> +#define MAPPING_EXCEPTION    ERR_PTR(-X86EMUL_EXCEPTION)
> +#define MAPPING_SILENT_FAIL  ERR_PTR(-X86EMUL_OKAY)

... this last one is certainly a little off to have the minus: No matter
what, we fully depend on X86EMUL_OKAY being zero here.

Jan


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

 


Rackspace

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