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

[Xen-devel] [patch 3/3 v2] xen/privcmd: add a __user annotation to a cast



Sparse complains that we lose the __user annotation in the cast here.

drivers/xen/privcmd.c:388:35: warning: cast removes address space of expression
drivers/xen/privcmd.c:388:32: warning: incorrect type in assignment (different 
address spaces)
drivers/xen/privcmd.c:388:32:    expected unsigned long [noderef] [usertype] 
<asn:1>*[addressable] [assigned] user_mfn
drivers/xen/privcmd.c:388:32:    got unsigned long [usertype] *<noident>

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
v2: In v1 I removed the const from the declaration but now I just removed it
from the cast.  This data can either be a v1 or a v2 type struct.  The m.arr
data is const in version 2 but not in version 1.

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 0ce006a..fceb83e 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -389,7 +389,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, 
int version)
 
        if (state.global_error && (version == 1)) {
                /* Write back errors in second pass. */
-               state.user_mfn = (xen_pfn_t *)m.arr;
+               state.user_mfn = (xen_pfn_t __user *)m.arr;
                state.err      = err_array;
                ret = traverse_pages(m.num, sizeof(xen_pfn_t),
                                     &pagelist, mmap_return_errors_v1, &state);

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