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

Re: [Xen-devel] [PATCH 4/5] xen: Enforce casting for guest_handle_cast



>>> On 31.05.12 at 17:07, Jean Guyader <jean.guyader@xxxxxxxxxx> wrote:
>--- a/xen/include/asm-x86/guest_access.h
>+++ b/xen/include/asm-x86/guest_access.h
>@@ -47,7 +47,7 @@
> 
> /* Cast a guest handle to the specified type of handle. */
> #define guest_handle_cast(hnd, type) ({         \
>-    type *_x = (hnd).p;                         \
>+    type *_x = (type *)(hnd).p;                 \


You would have to explain how this is safe: Without the cast, we
get compiler warnings (and hence build failures due to -Werror)
if "type *" and typeof((hnd).p) are incompatible. Adding an
explicit cast removes that intentional check.

Jan

>     (XEN_GUEST_HANDLE(type)) { _x };            \
> })
> 


_______________________________________________
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®.