On 09.12.2020 17:09, Juergen Gross wrote:
> --- a/xen/include/xen/guest_access.h
> +++ b/xen/include/xen/guest_access.h
> @@ -26,6 +26,11 @@
> type *_x = (hnd).p; \
> (XEN_GUEST_HANDLE_PARAM(type)) { _x }; \
> })
> +/* Same for casting to a const type. */
> +#define guest_handle_const_cast(hnd, type) ({ \
> + const type *_x = (const type *)((hnd).p); \
> + (XEN_GUEST_HANDLE_PARAM(const_##type)) { _x }; \
> +})
Afaict this allow casting from e.g. uint to const_ulong. We
don't want to permit this (i.e. if really needed one is to
go through two steps). I think all it takes is dropping the
cast:
#define guest_handle_const_cast(hnd, type) ({ \
const type *_x = (hnd).p; \
(XEN_GUEST_HANDLE_PARAM(const_##type)) { _x }; \
})
With this
Reviewed-by: Jan Beulich <[email protected]>
and I'd be okay making the adjustment while committing
(provided it works and I didn't overlook anything).
Jan