Commit 02bf2dff authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: trivial i2o annotations

parent 13d4109d
...@@ -861,6 +861,7 @@ static int i2ob_ioctl(struct inode *inode, struct file *file, ...@@ -861,6 +861,7 @@ static int i2ob_ioctl(struct inode *inode, struct file *file,
{ {
struct gendisk *disk = inode->i_bdev->bd_disk; struct gendisk *disk = inode->i_bdev->bd_disk;
struct i2ob_device *dev = disk->private_data; struct i2ob_device *dev = disk->private_data;
void __user *argp = (void __user *)arg;
/* Anyone capable of this syscall can do *real bad* things */ /* Anyone capable of this syscall can do *real bad* things */
...@@ -873,13 +874,13 @@ static int i2ob_ioctl(struct inode *inode, struct file *file, ...@@ -873,13 +874,13 @@ static int i2ob_ioctl(struct inode *inode, struct file *file,
i2o_block_biosparam(get_capacity(disk), i2o_block_biosparam(get_capacity(disk),
&g.cylinders, &g.heads, &g.sectors); &g.cylinders, &g.heads, &g.sectors);
g.start = get_start_sect(inode->i_bdev); g.start = get_start_sect(inode->i_bdev);
return copy_to_user((void *)arg,&g, sizeof(g))?-EFAULT:0; return copy_to_user(argp, &g, sizeof(g))?-EFAULT:0;
} }
case BLKI2OGRSTRAT: case BLKI2OGRSTRAT:
return put_user(dev->rcache, (int *)arg); return put_user(dev->rcache, (int __user *)argp);
case BLKI2OGWSTRAT: case BLKI2OGWSTRAT:
return put_user(dev->wcache, (int *)arg); return put_user(dev->wcache, (int __user *)argp);
case BLKI2OSRSTRAT: case BLKI2OSRSTRAT:
if(arg<0||arg>CACHE_SMARTFETCH) if(arg<0||arg>CACHE_SMARTFETCH)
return -EINVAL; return -EINVAL;
......
...@@ -194,7 +194,7 @@ struct i2o_handler cfg_handler= ...@@ -194,7 +194,7 @@ struct i2o_handler cfg_handler=
0xffffffff // All classes 0xffffffff // All classes
}; };
static ssize_t cfg_write(struct file *file, const char *buf, size_t count, loff_t *ppos) static ssize_t cfg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
printk(KERN_INFO "i2o_config write not yet supported\n"); printk(KERN_INFO "i2o_config write not yet supported\n");
...@@ -202,7 +202,7 @@ static ssize_t cfg_write(struct file *file, const char *buf, size_t count, loff_ ...@@ -202,7 +202,7 @@ static ssize_t cfg_write(struct file *file, const char *buf, size_t count, loff_
} }
static ssize_t cfg_read(struct file *file, char *buf, size_t count, loff_t *ptr) static ssize_t cfg_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
{ {
return 0; return 0;
} }
...@@ -278,7 +278,7 @@ static int cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, ...@@ -278,7 +278,7 @@ static int cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
int ioctl_getiops(unsigned long arg) int ioctl_getiops(unsigned long arg)
{ {
u8 *user_iop_table = (u8*)arg; u8 __user *user_iop_table = (void __user *)arg;
struct i2o_controller *c = NULL; struct i2o_controller *c = NULL;
int i; int i;
u8 foo[MAX_I2O_CONTROLLERS]; u8 foo[MAX_I2O_CONTROLLERS];
...@@ -314,7 +314,7 @@ int ioctl_getiops(unsigned long arg) ...@@ -314,7 +314,7 @@ int ioctl_getiops(unsigned long arg)
int ioctl_gethrt(unsigned long arg) int ioctl_gethrt(unsigned long arg)
{ {
struct i2o_controller *c; struct i2o_controller *c;
struct i2o_cmd_hrtlct *cmd = (struct i2o_cmd_hrtlct*)arg; struct i2o_cmd_hrtlct __user *cmd = (void __user *)arg;
struct i2o_cmd_hrtlct kcmd; struct i2o_cmd_hrtlct kcmd;
i2o_hrt *hrt; i2o_hrt *hrt;
int len; int len;
...@@ -353,7 +353,7 @@ int ioctl_gethrt(unsigned long arg) ...@@ -353,7 +353,7 @@ int ioctl_gethrt(unsigned long arg)
int ioctl_getlct(unsigned long arg) int ioctl_getlct(unsigned long arg)
{ {
struct i2o_controller *c; struct i2o_controller *c;
struct i2o_cmd_hrtlct *cmd = (struct i2o_cmd_hrtlct*)arg; struct i2o_cmd_hrtlct __user *cmd = (void __user *)arg;
struct i2o_cmd_hrtlct kcmd; struct i2o_cmd_hrtlct kcmd;
i2o_lct *lct; i2o_lct *lct;
int len; int len;
...@@ -390,7 +390,7 @@ static int ioctl_parms(unsigned long arg, unsigned int type) ...@@ -390,7 +390,7 @@ static int ioctl_parms(unsigned long arg, unsigned int type)
{ {
int ret = 0; int ret = 0;
struct i2o_controller *c; struct i2o_controller *c;
struct i2o_cmd_psetget *cmd = (struct i2o_cmd_psetget*)arg; struct i2o_cmd_psetget __user *cmd = (void __user *)arg;
struct i2o_cmd_psetget kcmd; struct i2o_cmd_psetget kcmd;
u32 reslen; u32 reslen;
u8 *ops; u8 *ops;
...@@ -460,7 +460,7 @@ static int ioctl_parms(unsigned long arg, unsigned int type) ...@@ -460,7 +460,7 @@ static int ioctl_parms(unsigned long arg, unsigned int type)
int ioctl_html(unsigned long arg) int ioctl_html(unsigned long arg)
{ {
struct i2o_html *cmd = (struct i2o_html*)arg; struct i2o_html __user *cmd = (void __user *)arg;
struct i2o_html kcmd; struct i2o_html kcmd;
struct i2o_controller *c; struct i2o_controller *c;
u8 *res = NULL; u8 *res = NULL;
...@@ -573,7 +573,7 @@ int ioctl_html(unsigned long arg) ...@@ -573,7 +573,7 @@ int ioctl_html(unsigned long arg)
int ioctl_swdl(unsigned long arg) int ioctl_swdl(unsigned long arg)
{ {
struct i2o_sw_xfer kxfer; struct i2o_sw_xfer kxfer;
struct i2o_sw_xfer *pxfer = (struct i2o_sw_xfer *)arg; struct i2o_sw_xfer __user *pxfer = (void __user *)arg;
unsigned char maxfrag = 0, curfrag = 1; unsigned char maxfrag = 0, curfrag = 1;
unsigned char *buffer; unsigned char *buffer;
u32 msg[9]; u32 msg[9];
...@@ -642,7 +642,7 @@ int ioctl_swdl(unsigned long arg) ...@@ -642,7 +642,7 @@ int ioctl_swdl(unsigned long arg)
int ioctl_swul(unsigned long arg) int ioctl_swul(unsigned long arg)
{ {
struct i2o_sw_xfer kxfer; struct i2o_sw_xfer kxfer;
struct i2o_sw_xfer *pxfer = (struct i2o_sw_xfer *)arg; struct i2o_sw_xfer __user *pxfer = (void __user *)arg;
unsigned char maxfrag = 0, curfrag = 1; unsigned char maxfrag = 0, curfrag = 1;
unsigned char *buffer; unsigned char *buffer;
u32 msg[9]; u32 msg[9];
...@@ -709,7 +709,8 @@ int ioctl_swul(unsigned long arg) ...@@ -709,7 +709,8 @@ int ioctl_swul(unsigned long arg)
int ioctl_swdel(unsigned long arg) int ioctl_swdel(unsigned long arg)
{ {
struct i2o_controller *c; struct i2o_controller *c;
struct i2o_sw_xfer kxfer, *pxfer = (struct i2o_sw_xfer *)arg; struct i2o_sw_xfer kxfer;
struct i2o_sw_xfer __user *pxfer = (void __user *)arg;
u32 msg[7]; u32 msg[7];
unsigned int swlen; unsigned int swlen;
int token; int token;
...@@ -776,7 +777,7 @@ int ioctl_validate(unsigned long arg) ...@@ -776,7 +777,7 @@ int ioctl_validate(unsigned long arg)
static int ioctl_evt_reg(unsigned long arg, struct file *fp) static int ioctl_evt_reg(unsigned long arg, struct file *fp)
{ {
u32 msg[5]; u32 msg[5];
struct i2o_evt_id *pdesc = (struct i2o_evt_id *)arg; struct i2o_evt_id __user *pdesc = (void __user *)arg;
struct i2o_evt_id kdesc; struct i2o_evt_id kdesc;
struct i2o_controller *iop; struct i2o_controller *iop;
struct i2o_device *d; struct i2o_device *d;
...@@ -813,7 +814,7 @@ static int ioctl_evt_get(unsigned long arg, struct file *fp) ...@@ -813,7 +814,7 @@ static int ioctl_evt_get(unsigned long arg, struct file *fp)
{ {
u32 id = (u32)fp->private_data; u32 id = (u32)fp->private_data;
struct i2o_cfg_info *p = NULL; struct i2o_cfg_info *p = NULL;
struct i2o_evt_get *uget = (struct i2o_evt_get*)arg; struct i2o_evt_get __user *uget = (void __user *)arg;
struct i2o_evt_get kget; struct i2o_evt_get kget;
unsigned long flags; unsigned long flags;
...@@ -842,21 +843,21 @@ static int ioctl_evt_get(unsigned long arg, struct file *fp) ...@@ -842,21 +843,21 @@ static int ioctl_evt_get(unsigned long arg, struct file *fp)
static int ioctl_passthru(unsigned long arg) static int ioctl_passthru(unsigned long arg)
{ {
struct i2o_cmd_passthru *cmd = (struct i2o_cmd_passthru *) arg; struct i2o_cmd_passthru __user *cmd = (void __user *) arg;
struct i2o_controller *c; struct i2o_controller *c;
u32 msg[MSG_FRAME_SIZE]; u32 msg[MSG_FRAME_SIZE];
u32 *user_msg = (u32*)cmd->msg; u32 __user *user_msg;
u32 *reply = NULL; u32 *reply = NULL;
u32 *user_reply = NULL; u32 __user *user_reply = NULL;
u32 size = 0; u32 size = 0;
u32 reply_size = 0; u32 reply_size = 0;
u32 rcode = 0; u32 rcode = 0;
ulong sg_list[SG_TABLESIZE]; void *sg_list[SG_TABLESIZE];
u32 sg_offset = 0; u32 sg_offset = 0;
u32 sg_count = 0; u32 sg_count = 0;
int sg_index = 0; int sg_index = 0;
u32 i = 0; u32 i = 0;
ulong p = 0; void *p = 0;
unsigned int iop; unsigned int iop;
if (get_user(iop, &cmd->iop) || get_user(user_msg, &cmd->msg)) if (get_user(iop, &cmd->iop) || get_user(user_msg, &cmd->msg))
...@@ -877,7 +878,7 @@ static int ioctl_passthru(unsigned long arg) ...@@ -877,7 +878,7 @@ static int ioctl_passthru(unsigned long arg)
size *= 4; // Convert to bytes size *= 4; // Convert to bytes
/* Copy in the user's I2O command */ /* Copy in the user's I2O command */
if(copy_from_user((void*)msg, (void*)user_msg, size)) if(copy_from_user(msg, user_msg, size))
return -EFAULT; return -EFAULT;
if(get_user(reply_size, &user_reply[0]) < 0) if(get_user(reply_size, &user_reply[0]) < 0)
return -EFAULT; return -EFAULT;
...@@ -920,7 +921,7 @@ static int ioctl_passthru(unsigned long arg) ...@@ -920,7 +921,7 @@ static int ioctl_passthru(unsigned long arg)
} }
sg_size = sg[i].flag_count & 0xffffff; sg_size = sg[i].flag_count & 0xffffff;
/* Allocate memory for the transfer */ /* Allocate memory for the transfer */
p = (ulong)kmalloc(sg_size, GFP_KERNEL); p = kmalloc(sg_size, GFP_KERNEL);
if (!p) { if (!p) {
printk(KERN_DEBUG"%s: Could not allocate SG buffer - size = %d buffer number %d of %d\n", c->name,sg_size,i,sg_count); printk(KERN_DEBUG"%s: Could not allocate SG buffer - size = %d buffer number %d of %d\n", c->name,sg_size,i,sg_count);
rcode = -ENOMEM; rcode = -ENOMEM;
...@@ -930,14 +931,14 @@ static int ioctl_passthru(unsigned long arg) ...@@ -930,14 +931,14 @@ static int ioctl_passthru(unsigned long arg)
/* Copy in the user's SG buffer if necessary */ /* Copy in the user's SG buffer if necessary */
if(sg[i].flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR*/) { if(sg[i].flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR*/) {
// TODO 64bit fix // TODO 64bit fix
if (copy_from_user((void*)p,(void*)sg[i].addr_bus, sg_size)) { if (copy_from_user(p,(void __user *)sg[i].addr_bus, sg_size)) {
printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",c->name,i); printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",c->name,i);
rcode = -EFAULT; rcode = -EFAULT;
goto cleanup; goto cleanup;
} }
} }
//TODO 64bit fix //TODO 64bit fix
sg[i].addr_bus = (u32)virt_to_bus((void*)p); sg[i].addr_bus = (u32)virt_to_bus(p);
} }
} }
...@@ -962,7 +963,7 @@ static int ioctl_passthru(unsigned long arg) ...@@ -962,7 +963,7 @@ static int ioctl_passthru(unsigned long arg)
size = size>>16; size = size>>16;
size *= 4; size *= 4;
/* Copy in the user's I2O command */ /* Copy in the user's I2O command */
if (copy_from_user ((void*)msg, (void*)user_msg, size)) { if (copy_from_user (msg, user_msg, size)) {
rcode = -EFAULT; rcode = -EFAULT;
goto cleanup; goto cleanup;
} }
...@@ -975,8 +976,8 @@ static int ioctl_passthru(unsigned long arg) ...@@ -975,8 +976,8 @@ static int ioctl_passthru(unsigned long arg)
if (!(sg[j].flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR*/)) { if (!(sg[j].flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR*/)) {
sg_size = sg[j].flag_count & 0xffffff; sg_size = sg[j].flag_count & 0xffffff;
// TODO 64bit fix // TODO 64bit fix
if (copy_to_user((void*)sg[j].addr_bus,(void*)sg_list[j], sg_size)) { if (copy_to_user((void __user *)sg[j].addr_bus,sg_list[j], sg_size)) {
printk(KERN_WARNING"%s: Could not copy %lx TO user %x\n",c->name, sg_list[j], sg[j].addr_bus); printk(KERN_WARNING"%s: Could not copy %p TO user %x\n",c->name, sg_list[j], sg[j].addr_bus);
rcode = -EFAULT; rcode = -EFAULT;
goto cleanup; goto cleanup;
} }
......
...@@ -46,24 +46,24 @@ ...@@ -46,24 +46,24 @@
struct i2o_cmd_passthru struct i2o_cmd_passthru
{ {
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
void *msg; /* message */ void __user *msg; /* message */
}; };
struct i2o_cmd_hrtlct struct i2o_cmd_hrtlct
{ {
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
void *resbuf; /* Buffer for result */ void __user *resbuf; /* Buffer for result */
unsigned int *reslen; /* Buffer length in bytes */ unsigned int __user *reslen; /* Buffer length in bytes */
}; };
struct i2o_cmd_psetget struct i2o_cmd_psetget
{ {
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
unsigned int tid; /* Target device TID */ unsigned int tid; /* Target device TID */
void *opbuf; /* Operation List buffer */ void __user *opbuf; /* Operation List buffer */
unsigned int oplen; /* Operation List buffer length in bytes */ unsigned int oplen; /* Operation List buffer length in bytes */
void *resbuf; /* Result List buffer */ void __user *resbuf; /* Result List buffer */
unsigned int *reslen; /* Result List buffer length in bytes */ unsigned int __user *reslen; /* Result List buffer length in bytes */
}; };
struct i2o_sw_xfer struct i2o_sw_xfer
...@@ -72,10 +72,10 @@ struct i2o_sw_xfer ...@@ -72,10 +72,10 @@ struct i2o_sw_xfer
unsigned char flags; /* Flags field */ unsigned char flags; /* Flags field */
unsigned char sw_type; /* Software type */ unsigned char sw_type; /* Software type */
unsigned int sw_id; /* Software ID */ unsigned int sw_id; /* Software ID */
void *buf; /* Pointer to software buffer */ void __user *buf; /* Pointer to software buffer */
unsigned int *swlen; /* Length of software data */ unsigned int __user *swlen; /* Length of software data */
unsigned int *maxfrag; /* Maximum fragment count */ unsigned int __user *maxfrag; /* Maximum fragment count */
unsigned int *curfrag; /* Current fragment count */ unsigned int __user *curfrag; /* Current fragment count */
}; };
struct i2o_html struct i2o_html
...@@ -83,9 +83,9 @@ struct i2o_html ...@@ -83,9 +83,9 @@ struct i2o_html
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
unsigned int tid; /* Target device ID */ unsigned int tid; /* Target device ID */
unsigned int page; /* HTML page */ unsigned int page; /* HTML page */
void *resbuf; /* Buffer for reply HTML page */ void __user *resbuf; /* Buffer for reply HTML page */
unsigned int *reslen; /* Length in bytes of reply buffer */ unsigned int __user *reslen; /* Length in bytes of reply buffer */
void *qbuf; /* Pointer to HTTP query string */ void __user *qbuf; /* Pointer to HTTP query string */
unsigned int qlen; /* Length in bytes of query string buffer */ unsigned int qlen; /* Length in bytes of query string buffer */
}; };
......
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