WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add __iomem and __user pointer annotations to linux spar

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add __iomem and __user pointer annotations to linux sparse tree.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Nov 2005 15:16:10 +0000
Delivery-date: Wed, 23 Nov 2005 15:16:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6cc603ac3f38f8f4b760899e963ef8165ae0c8ee
# Parent  17b98e15bf7821053992246c59701cd4dfd9553f
Add __iomem and __user pointer annotations to linux sparse tree.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r 17b98e15bf78 -r 6cc603ac3f38 
linux-2.6-xen-sparse/arch/xen/kernel/devmem.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c     Wed Nov 23 12:58:44 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c     Wed Nov 23 13:14:01 2005
@@ -45,7 +45,7 @@
 {
        unsigned long i, p = *ppos;
        ssize_t read = -EFAULT;
-       void *v;
+       void __iomem *v;
 
        if ((v = ioremap(p, count)) == NULL) {
                /*
@@ -75,7 +75,7 @@
 {
        unsigned long p = *ppos;
        ssize_t written = -EFAULT;
-       void *v;
+       void __iomem *v;
 
        if ((v = ioremap(p, count)) == NULL)
                return -EFAULT;
diff -r 17b98e15bf78 -r 6cc603ac3f38 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Wed Nov 23 
12:58:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Wed Nov 23 
13:14:01 2005
@@ -441,7 +441,7 @@
        case CDROMMULTISESSION:
                DPRINTK("FIXME: support multisession CDs later\n");
                for (i = 0; i < sizeof(struct cdrom_multisession); i++)
-                       if (put_user(0, (char *)(argument + i)))
+                       if (put_user(0, (char __user *)(argument + i)))
                                return -EFAULT;
                return 0;
 
diff -r 17b98e15bf78 -r 6cc603ac3f38 
linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
--- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c  Wed Nov 23 12:58:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c  Wed Nov 23 13:14:01 2005
@@ -89,7 +89,7 @@
        spin_unlock(&port_user_lock);
 }
 
-static ssize_t evtchn_read(struct file *file, char *buf,
+static ssize_t evtchn_read(struct file *file, char __user *buf,
                            size_t count, loff_t *ppos)
 {
        int rc;
@@ -168,7 +168,7 @@
        return rc;
 }
 
-static ssize_t evtchn_write(struct file *file, const char *buf,
+static ssize_t evtchn_write(struct file *file, const char __user *buf,
                             size_t count, loff_t *ppos)
 {
        int  rc, i;
@@ -220,6 +220,7 @@
 {
        int rc;
        struct per_user_data *u = file->private_data;
+       void __user *uarg = (void __user *) arg;
        evtchn_op_t op = { 0 };
 
        switch (cmd) {
@@ -227,7 +228,7 @@
                struct ioctl_evtchn_bind_virq bind;
 
                rc = -EFAULT;
-               if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
+               if (copy_from_user(&bind, uarg, sizeof(bind)))
                        break;
 
                op.cmd = EVTCHNOP_bind_virq;
@@ -246,7 +247,7 @@
                struct ioctl_evtchn_bind_interdomain bind;
 
                rc = -EFAULT;
-               if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
+               if (copy_from_user(&bind, uarg, sizeof(bind)))
                        break;
 
                op.cmd = EVTCHNOP_bind_interdomain;
@@ -265,7 +266,7 @@
                struct ioctl_evtchn_bind_unbound_port bind;
 
                rc = -EFAULT;
-               if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
+               if (copy_from_user(&bind, uarg, sizeof(bind)))
                        break;
 
                op.cmd = EVTCHNOP_alloc_unbound;
@@ -285,7 +286,7 @@
                int ret;
 
                rc = -EFAULT;
-               if (copy_from_user(&unbind, (void *)arg, sizeof(unbind)))
+               if (copy_from_user(&unbind, uarg, sizeof(unbind)))
                        break;
 
                rc = -EINVAL;
@@ -318,7 +319,7 @@
                struct ioctl_evtchn_notify notify;
 
                rc = -EFAULT;
-               if (copy_from_user(&notify, (void *)arg, sizeof(notify)))
+               if (copy_from_user(&notify, uarg, sizeof(notify)))
                        break;
 
                if (notify.port >= NR_EVENT_CHANNELS) {
diff -r 17b98e15bf78 -r 6cc603ac3f38 
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Wed Nov 23 
12:58:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Wed Nov 23 
13:14:01 2005
@@ -38,13 +38,13 @@
                          unsigned int cmd, unsigned long data)
 {
        int ret = -ENOSYS;
+       void __user *udata = (void __user *) data;
 
        switch (cmd) {
        case IOCTL_PRIVCMD_HYPERCALL: {
                privcmd_hypercall_t hypercall;
   
-               if (copy_from_user(&hypercall, (void *)data,
-                                  sizeof(hypercall)))
+               if (copy_from_user(&hypercall, udata, sizeof(hypercall)))
                        return -EFAULT;
 
 #if defined(__i386__)
@@ -97,10 +97,11 @@
        case IOCTL_PRIVCMD_MMAP: {
 #define PRIVCMD_MMAP_SZ 32
                privcmd_mmap_t mmapcmd;
-               privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p;
+               privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ];
+               privcmd_mmap_entry_t __user *p;
                int i, rc;
 
-               if (copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)))
+               if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd)))
                        return -EFAULT;
 
                p = mmapcmd.entry;
@@ -146,12 +147,12 @@
                mmu_update_t u;
                privcmd_mmapbatch_t m;
                struct vm_area_struct *vma = NULL;
-               unsigned long *p, addr;
-               unsigned long mfn; 
+               unsigned long __user *p;
+               unsigned long addr, mfn; 
                uint64_t ptep;
                int i;
 
-               if (copy_from_user(&m, (void *)data, sizeof(m))) {
+               if (copy_from_user(&m, udata, sizeof(m))) {
                        ret = -EFAULT;
                        goto batch_err;
                }
@@ -219,7 +220,7 @@
                pmd_t *pmd; 
                unsigned long m2pv, m2p_mfn;    
                privcmd_m2pmfns_t m; 
-               unsigned long *p; 
+               unsigned long __user *p;
                int i; 
 
 #if defined (__x86_64__)
@@ -233,7 +234,8 @@
                ret = -EINVAL; 
                break; 
 #endif
-               if (copy_from_user(&m, (void *)data, sizeof(m)))
+
+               if (copy_from_user(&m, udata, sizeof(m)))
                        return -EFAULT;
 
                m2pv = (unsigned long)machine_to_phys_mapping;
diff -r 17b98e15bf78 -r 6cc603ac3f38 linux-2.6-xen-sparse/drivers/xen/util.c
--- a/linux-2.6-xen-sparse/drivers/xen/util.c   Wed Nov 23 12:58:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/util.c   Wed Nov 23 13:14:01 2005
@@ -56,7 +56,7 @@
         * page-fault path will copy the page directory pointers from init_mm.
         */
        for (i = 0; i < area->size; i += PAGE_SIZE)
-               (void)__get_user(c, (char *)area->addr + i);
+               (void)__get_user(c, (char __user *)area->addr + i);
 }
 
 void unlock_vm_area(struct vm_struct *area)
diff -r 17b98e15bf78 -r 6cc603ac3f38 
linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h
--- a/linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h       Wed Nov 
23 12:58:44 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h       Wed Nov 
23 13:14:01 2005
@@ -30,6 +30,10 @@
 #ifndef __LINUX_PUBLIC_PRIVCMD_H__
 #define __LINUX_PUBLIC_PRIVCMD_H__
 
+#ifndef __user
+#define __user
+#endif
+
 typedef struct privcmd_hypercall
 {
        unsigned long op;
@@ -45,19 +49,19 @@
 typedef struct privcmd_mmap {
        int num;
        domid_t dom; /* target domain */
-       privcmd_mmap_entry_t *entry;
+       privcmd_mmap_entry_t __user *entry;
 } privcmd_mmap_t; 
 
 typedef struct privcmd_mmapbatch {
        int num;     /* number of pages to populate */
        domid_t dom; /* target domain */
        unsigned long addr;  /* virtual address */
-       unsigned long *arr; /* array of mfns - top nibble set on err */
+       unsigned long __user *arr; /* array of mfns - top nibble set on err */
 } privcmd_mmapbatch_t; 
 
 typedef struct privcmd_m2pmfns { 
        int num;    /* max number of mfns to return */
-       unsigned long *arr; /* array of mfns */
+       unsigned long __user *arr; /* array of mfns */
 } privcmd_m2pmfns_t; 
 
 typedef struct privcmd_blkmsg

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add __iomem and __user pointer annotations to linux sparse tree., Xen patchbot -unstable <=