Commit 8c881385 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: rest of drivers/block annotation

parent fe2a5a14
...@@ -413,7 +413,7 @@ static unsigned long carm_major_alloc; ...@@ -413,7 +413,7 @@ static unsigned long carm_major_alloc;
static int carm_bdev_ioctl(struct inode *ino, struct file *fil, static int carm_bdev_ioctl(struct inode *ino, struct file *fil,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *usermem = (void *) arg; void __user *usermem = (void __user *) arg;
struct carm_port *port = ino->i_bdev->bd_disk->private_data; struct carm_port *port = ino->i_bdev->bd_disk->private_data;
struct hd_geometry geom; struct hd_geometry geom;
......
...@@ -1063,17 +1063,17 @@ static int ps2esdi_ioctl(struct inode *inode, ...@@ -1063,17 +1063,17 @@ static int ps2esdi_ioctl(struct inode *inode,
struct file *file, u_int cmd, u_long arg) struct file *file, u_int cmd, u_long arg)
{ {
struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data; struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data;
struct ps2esdi_geometry *geometry = (struct ps2esdi_geometry *) arg; struct ps2esdi_geometry geom;
int err;
if (cmd != HDIO_GETGEO) if (cmd != HDIO_GETGEO)
return -EINVAL; return -EINVAL;
if ((err = verify_area(VERIFY_WRITE, geometry, sizeof(*geometry)))) memset(&geom, 0, sizeof(geom));
return (err); geom.heads = p->head;
put_user(p->head, (char *) &geometry->heads); geom.sectors = p->sect;
put_user(p->sect, (char *) &geometry->sectors); geom.cylinders = p->cyl;
put_user(p->cyl, (short *) &geometry->cylinders); geom.start = get_start_sect(inode->i_bdev);
put_user(get_start_sect(inode->i_bdev), (long *) &geometry->start); if (copy_to_user((void __user *)arg, &geom, sizeof(geom)))
return -EFAULT;
return 0; return 0;
} }
......
...@@ -833,7 +833,7 @@ static int mm_ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned ...@@ -833,7 +833,7 @@ static int mm_ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned
geo.start = get_start_sect(i->i_bdev); geo.start = get_start_sect(i->i_bdev);
geo.cylinders = size / (geo.heads * geo.sectors); geo.cylinders = size / (geo.heads * geo.sectors);
if (copy_to_user((void *) arg, &geo, sizeof(geo))) if (copy_to_user((void __user *) arg, &geo, sizeof(geo)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
...@@ -330,12 +330,12 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) ...@@ -330,12 +330,12 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg)
case HDIO_GETGEO: case HDIO_GETGEO:
{ {
struct hd_geometry g; struct hd_geometry g;
struct hd_geometry *geometry = (struct hd_geometry *) arg; struct hd_geometry __user *geom= (void __user *)arg;
g.heads = p->heads; g.heads = p->heads;
g.sectors = p->sectors; g.sectors = p->sectors;
g.cylinders = p->cylinders; g.cylinders = p->cylinders;
g.start = get_start_sect(inode->i_bdev); g.start = get_start_sect(inode->i_bdev);
return copy_to_user(geometry, &g, sizeof g) ? -EFAULT : 0; return copy_to_user(geom, &g, sizeof(g)) ? -EFAULT : 0;
} }
case HDIO_SET_DMA: case HDIO_SET_DMA:
if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!capable(CAP_SYS_ADMIN)) return -EACCES;
...@@ -354,9 +354,9 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) ...@@ -354,9 +354,9 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg)
} }
return 0; return 0;
case HDIO_GET_DMA: case HDIO_GET_DMA:
return put_user(!nodma, (long *) arg); return put_user(!nodma, (long __user *) arg);
case HDIO_GET_MULTCOUNT: case HDIO_GET_MULTCOUNT:
return put_user(xd_maxsectors, (long *) arg); return put_user(xd_maxsectors, (long __user *) arg);
default: default:
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment