ia64/xen-unstable

changeset 8004:6cc603ac3f38

Add __iomem and __user pointer annotations to linux sparse tree.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 23 14:14:01 2005 +0100 (2005-11-23)
parents 17b98e15bf78
children 14d733e5e1d0
files linux-2.6-xen-sparse/arch/xen/kernel/devmem.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/util.c linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c	Wed Nov 23 13:58:44 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c	Wed Nov 23 14:14:01 2005 +0100
     1.3 @@ -45,7 +45,7 @@ static ssize_t read_mem(struct file * fi
     1.4  {
     1.5  	unsigned long i, p = *ppos;
     1.6  	ssize_t read = -EFAULT;
     1.7 -	void *v;
     1.8 +	void __iomem *v;
     1.9  
    1.10  	if ((v = ioremap(p, count)) == NULL) {
    1.11  		/*
    1.12 @@ -75,7 +75,7 @@ static ssize_t write_mem(struct file * f
    1.13  {
    1.14  	unsigned long p = *ppos;
    1.15  	ssize_t written = -EFAULT;
    1.16 -	void *v;
    1.17 +	void __iomem *v;
    1.18  
    1.19  	if ((v = ioremap(p, count)) == NULL)
    1.20  		return -EFAULT;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Nov 23 13:58:44 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Nov 23 14:14:01 2005 +0100
     2.3 @@ -441,7 +441,7 @@ int blkif_ioctl(struct inode *inode, str
     2.4  	case CDROMMULTISESSION:
     2.5  		DPRINTK("FIXME: support multisession CDs later\n");
     2.6  		for (i = 0; i < sizeof(struct cdrom_multisession); i++)
     2.7 -			if (put_user(0, (char *)(argument + i)))
     2.8 +			if (put_user(0, (char __user *)(argument + i)))
     2.9  				return -EFAULT;
    2.10  		return 0;
    2.11  
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Wed Nov 23 13:58:44 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Wed Nov 23 14:14:01 2005 +0100
     3.3 @@ -89,7 +89,7 @@ void evtchn_device_upcall(int port)
     3.4  	spin_unlock(&port_user_lock);
     3.5  }
     3.6  
     3.7 -static ssize_t evtchn_read(struct file *file, char *buf,
     3.8 +static ssize_t evtchn_read(struct file *file, char __user *buf,
     3.9                             size_t count, loff_t *ppos)
    3.10  {
    3.11  	int rc;
    3.12 @@ -168,7 +168,7 @@ static ssize_t evtchn_read(struct file *
    3.13  	return rc;
    3.14  }
    3.15  
    3.16 -static ssize_t evtchn_write(struct file *file, const char *buf,
    3.17 +static ssize_t evtchn_write(struct file *file, const char __user *buf,
    3.18                              size_t count, loff_t *ppos)
    3.19  {
    3.20  	int  rc, i;
    3.21 @@ -220,6 +220,7 @@ static int evtchn_ioctl(struct inode *in
    3.22  {
    3.23  	int rc;
    3.24  	struct per_user_data *u = file->private_data;
    3.25 +	void __user *uarg = (void __user *) arg;
    3.26  	evtchn_op_t op = { 0 };
    3.27  
    3.28  	switch (cmd) {
    3.29 @@ -227,7 +228,7 @@ static int evtchn_ioctl(struct inode *in
    3.30  		struct ioctl_evtchn_bind_virq bind;
    3.31  
    3.32  		rc = -EFAULT;
    3.33 -		if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
    3.34 +		if (copy_from_user(&bind, uarg, sizeof(bind)))
    3.35  			break;
    3.36  
    3.37  		op.cmd = EVTCHNOP_bind_virq;
    3.38 @@ -246,7 +247,7 @@ static int evtchn_ioctl(struct inode *in
    3.39  		struct ioctl_evtchn_bind_interdomain bind;
    3.40  
    3.41  		rc = -EFAULT;
    3.42 -		if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
    3.43 +		if (copy_from_user(&bind, uarg, sizeof(bind)))
    3.44  			break;
    3.45  
    3.46  		op.cmd = EVTCHNOP_bind_interdomain;
    3.47 @@ -265,7 +266,7 @@ static int evtchn_ioctl(struct inode *in
    3.48  		struct ioctl_evtchn_bind_unbound_port bind;
    3.49  
    3.50  		rc = -EFAULT;
    3.51 -		if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
    3.52 +		if (copy_from_user(&bind, uarg, sizeof(bind)))
    3.53  			break;
    3.54  
    3.55  		op.cmd = EVTCHNOP_alloc_unbound;
    3.56 @@ -285,7 +286,7 @@ static int evtchn_ioctl(struct inode *in
    3.57  		int ret;
    3.58  
    3.59  		rc = -EFAULT;
    3.60 -		if (copy_from_user(&unbind, (void *)arg, sizeof(unbind)))
    3.61 +		if (copy_from_user(&unbind, uarg, sizeof(unbind)))
    3.62  			break;
    3.63  
    3.64  		rc = -EINVAL;
    3.65 @@ -318,7 +319,7 @@ static int evtchn_ioctl(struct inode *in
    3.66  		struct ioctl_evtchn_notify notify;
    3.67  
    3.68  		rc = -EFAULT;
    3.69 -		if (copy_from_user(&notify, (void *)arg, sizeof(notify)))
    3.70 +		if (copy_from_user(&notify, uarg, sizeof(notify)))
    3.71  			break;
    3.72  
    3.73  		if (notify.port >= NR_EVENT_CHANNELS) {
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Nov 23 13:58:44 2005 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Nov 23 14:14:01 2005 +0100
     4.3 @@ -38,13 +38,13 @@ static int privcmd_ioctl(struct inode *i
     4.4                           unsigned int cmd, unsigned long data)
     4.5  {
     4.6  	int ret = -ENOSYS;
     4.7 +	void __user *udata = (void __user *) data;
     4.8  
     4.9  	switch (cmd) {
    4.10  	case IOCTL_PRIVCMD_HYPERCALL: {
    4.11  		privcmd_hypercall_t hypercall;
    4.12    
    4.13 -		if (copy_from_user(&hypercall, (void *)data,
    4.14 -				   sizeof(hypercall)))
    4.15 +		if (copy_from_user(&hypercall, udata, sizeof(hypercall)))
    4.16  			return -EFAULT;
    4.17  
    4.18  #if defined(__i386__)
    4.19 @@ -97,10 +97,11 @@ static int privcmd_ioctl(struct inode *i
    4.20  	case IOCTL_PRIVCMD_MMAP: {
    4.21  #define PRIVCMD_MMAP_SZ 32
    4.22  		privcmd_mmap_t mmapcmd;
    4.23 -		privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p;
    4.24 +		privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ];
    4.25 +		privcmd_mmap_entry_t __user *p;
    4.26  		int i, rc;
    4.27  
    4.28 -		if (copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)))
    4.29 +		if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd)))
    4.30  			return -EFAULT;
    4.31  
    4.32  		p = mmapcmd.entry;
    4.33 @@ -146,12 +147,12 @@ static int privcmd_ioctl(struct inode *i
    4.34  		mmu_update_t u;
    4.35  		privcmd_mmapbatch_t m;
    4.36  		struct vm_area_struct *vma = NULL;
    4.37 -		unsigned long *p, addr;
    4.38 -		unsigned long mfn; 
    4.39 +		unsigned long __user *p;
    4.40 +		unsigned long addr, mfn; 
    4.41  		uint64_t ptep;
    4.42  		int i;
    4.43  
    4.44 -		if (copy_from_user(&m, (void *)data, sizeof(m))) {
    4.45 +		if (copy_from_user(&m, udata, sizeof(m))) {
    4.46  			ret = -EFAULT;
    4.47  			goto batch_err;
    4.48  		}
    4.49 @@ -219,7 +220,7 @@ static int privcmd_ioctl(struct inode *i
    4.50  		pmd_t *pmd; 
    4.51  		unsigned long m2pv, m2p_mfn; 	
    4.52  		privcmd_m2pmfns_t m; 
    4.53 -		unsigned long *p; 
    4.54 +		unsigned long __user *p;
    4.55  		int i; 
    4.56  
    4.57  #if defined (__x86_64__)
    4.58 @@ -233,7 +234,8 @@ static int privcmd_ioctl(struct inode *i
    4.59  		ret = -EINVAL; 
    4.60  		break; 
    4.61  #endif
    4.62 -		if (copy_from_user(&m, (void *)data, sizeof(m)))
    4.63 +
    4.64 +		if (copy_from_user(&m, udata, sizeof(m)))
    4.65  			return -EFAULT;
    4.66  
    4.67  		m2pv = (unsigned long)machine_to_phys_mapping;
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/util.c	Wed Nov 23 13:58:44 2005 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/util.c	Wed Nov 23 14:14:01 2005 +0100
     5.3 @@ -56,7 +56,7 @@ void lock_vm_area(struct vm_struct *area
     5.4  	 * page-fault path will copy the page directory pointers from init_mm.
     5.5  	 */
     5.6  	for (i = 0; i < area->size; i += PAGE_SIZE)
     5.7 -		(void)__get_user(c, (char *)area->addr + i);
     5.8 +		(void)__get_user(c, (char __user *)area->addr + i);
     5.9  }
    5.10  
    5.11  void unlock_vm_area(struct vm_struct *area)
     6.1 --- a/linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h	Wed Nov 23 13:58:44 2005 +0100
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h	Wed Nov 23 14:14:01 2005 +0100
     6.3 @@ -30,6 +30,10 @@
     6.4  #ifndef __LINUX_PUBLIC_PRIVCMD_H__
     6.5  #define __LINUX_PUBLIC_PRIVCMD_H__
     6.6  
     6.7 +#ifndef __user
     6.8 +#define __user
     6.9 +#endif
    6.10 +
    6.11  typedef struct privcmd_hypercall
    6.12  {
    6.13  	unsigned long op;
    6.14 @@ -45,19 +49,19 @@ typedef struct privcmd_mmap_entry {
    6.15  typedef struct privcmd_mmap {
    6.16  	int num;
    6.17  	domid_t dom; /* target domain */
    6.18 -	privcmd_mmap_entry_t *entry;
    6.19 +	privcmd_mmap_entry_t __user *entry;
    6.20  } privcmd_mmap_t; 
    6.21  
    6.22  typedef struct privcmd_mmapbatch {
    6.23  	int num;     /* number of pages to populate */
    6.24  	domid_t dom; /* target domain */
    6.25  	unsigned long addr;  /* virtual address */
    6.26 -	unsigned long *arr; /* array of mfns - top nibble set on err */
    6.27 +	unsigned long __user *arr; /* array of mfns - top nibble set on err */
    6.28  } privcmd_mmapbatch_t; 
    6.29  
    6.30  typedef struct privcmd_m2pmfns { 
    6.31  	int num;    /* max number of mfns to return */
    6.32 -	unsigned long *arr; /* array of mfns */
    6.33 +	unsigned long __user *arr; /* array of mfns */
    6.34  } privcmd_m2pmfns_t; 
    6.35  
    6.36  typedef struct privcmd_blkmsg