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

Re: [Xen-devel] [PATCH] do_callback_op()'s second argument can be const


  • To: Jan Beulich <jbeulich@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
  • Date: Fri, 18 Jan 2008 15:00:12 +0000
  • Delivery-date: Fri, 18 Jan 2008 07:00:46 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AchZ4tMlEXwJL8XWEdyBqQAX8io7RQ==
  • Thread-topic: [Xen-devel] [PATCH] do_callback_op()'s second argument can be const

This patch doesn't seem very useful since the guest can trivially cast its
way out of the const-ness. I certainly don't see how the chunk below fixes
anything -- doesn't it take two lines to state what took one line before?

 -- Keir

On 18/1/08 14:36, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:

> --- 2008-01-07.orig/xen/include/asm-x86/guest_access.h 2007-12-07
> 11:51:50.000000000 +0100
> +++ 2008-01-07/xen/include/asm-x86/guest_access.h 2008-01-07
> 12:11:43.000000000 +0100
> @@ -34,7 +34,8 @@
>   */
>  #define copy_to_guest_offset(hnd, off, ptr, nr) ({      \
>      const typeof(*(ptr)) *_s = (ptr);                   \
> -    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
> +    void *_p = (hnd).p;                                 \
> +    char (*_d)[sizeof(*_s)] = _p;                       \
>      ((void)((hnd).p == (ptr)));                         \
>      is_hvm_vcpu(current) ?                              \
>      copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) :  \
> @@ -82,7 +83,8 @@
>  
>  #define __copy_to_guest_offset(hnd, off, ptr, nr) ({    \
>      const typeof(*(ptr)) *_s = (ptr);                   \
> -    char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
> +    void *_p = (hnd).p;                                 \
> +    char (*_d)[sizeof(*_s)] = _p;                       \
>      ((void)((hnd).p == (ptr)));                         \
>      is_hvm_vcpu(current) ?                              \
>      copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) :  \



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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