Commit c5465a54 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: ipmi annotation

parent 0d944920
......@@ -231,6 +231,7 @@ static int ipmi_ioctl(struct inode *inode,
{
int rv = -EINVAL;
struct ipmi_file_private *priv = file->private_data;
void __user *arg = (void __user *)data;
switch (cmd)
{
......@@ -238,7 +239,7 @@ static int ipmi_ioctl(struct inode *inode,
{
struct ipmi_req req;
if (copy_from_user(&req, (void *) data, sizeof(req))) {
if (copy_from_user(&req, arg, sizeof(req))) {
rv = -EFAULT;
break;
}
......@@ -254,7 +255,7 @@ static int ipmi_ioctl(struct inode *inode,
{
struct ipmi_req_settime req;
if (copy_from_user(&req, (void *) data, sizeof(req))) {
if (copy_from_user(&req, arg, sizeof(req))) {
rv = -EFAULT;
break;
}
......@@ -277,7 +278,7 @@ static int ipmi_ioctl(struct inode *inode,
rv = 0;
if (copy_from_user(&rsp, (void *) data, sizeof(rsp))) {
if (copy_from_user(&rsp, arg, sizeof(rsp))) {
rv = -EFAULT;
break;
}
......@@ -344,7 +345,7 @@ static int ipmi_ioctl(struct inode *inode,
rsp.msg.data_len = 0;
}
if (copy_to_user((void *) data, &rsp, sizeof(rsp))) {
if (copy_to_user(arg, &rsp, sizeof(rsp))) {
rv = -EFAULT;
goto recv_putback_on_err;
}
......@@ -371,7 +372,7 @@ static int ipmi_ioctl(struct inode *inode,
{
struct ipmi_cmdspec val;
if (copy_from_user(&val, (void *) data, sizeof(val))) {
if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -384,7 +385,7 @@ static int ipmi_ioctl(struct inode *inode,
{
struct ipmi_cmdspec val;
if (copy_from_user(&val, (void *) data, sizeof(val))) {
if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -397,7 +398,7 @@ static int ipmi_ioctl(struct inode *inode,
{
int val;
if (copy_from_user(&val, (void *) data, sizeof(val))) {
if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -410,7 +411,7 @@ static int ipmi_ioctl(struct inode *inode,
{
unsigned int val;
if (copy_from_user(&val, (void *) data, sizeof(val))) {
if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -426,7 +427,7 @@ static int ipmi_ioctl(struct inode *inode,
val = ipmi_get_my_address(priv->user);
if (copy_to_user((void *) data, &val, sizeof(val))) {
if (copy_to_user(arg, &val, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -438,7 +439,7 @@ static int ipmi_ioctl(struct inode *inode,
{
unsigned int val;
if (copy_from_user(&val, (void *) data, sizeof(val))) {
if (copy_from_user(&val, arg, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -454,7 +455,7 @@ static int ipmi_ioctl(struct inode *inode,
val = ipmi_get_my_LUN(priv->user);
if (copy_to_user((void *) data, &val, sizeof(val))) {
if (copy_to_user(arg, &val, sizeof(val))) {
rv = -EFAULT;
break;
}
......@@ -465,7 +466,7 @@ static int ipmi_ioctl(struct inode *inode,
{
struct ipmi_timing_parms parms;
if (copy_from_user(&parms, (void *) data, sizeof(parms))) {
if (copy_from_user(&parms, arg, sizeof(parms))) {
rv = -EFAULT;
break;
}
......@@ -483,7 +484,7 @@ static int ipmi_ioctl(struct inode *inode,
parms.retries = priv->default_retries;
parms.retry_time_ms = priv->default_retry_time_ms;
if (copy_to_user((void *) data, &parms, sizeof(parms))) {
if (copy_to_user(arg, &parms, sizeof(parms))) {
rv = -EFAULT;
break;
}
......
......@@ -515,40 +515,37 @@ static struct watchdog_info ident=
static int ipmi_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int i;
int val;
switch(cmd) {
case WDIOC_GETSUPPORT:
i = copy_to_user((void*)arg, &ident, sizeof(ident));
i = copy_to_user(argp, &ident, sizeof(ident));
return i ? -EFAULT : 0;
case WDIOC_SETTIMEOUT:
i = copy_from_user(&val, (void *) arg, sizeof(int));
i = copy_from_user(&val, argp, sizeof(int));
if (i)
return -EFAULT;
timeout = val;
return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
case WDIOC_GETTIMEOUT:
i = copy_to_user((void *) arg,
&timeout,
sizeof(timeout));
i = copy_to_user(argp, &timeout, sizeof(timeout));
if (i)
return -EFAULT;
return 0;
case WDIOC_SET_PRETIMEOUT:
i = copy_from_user(&val, (void *) arg, sizeof(int));
i = copy_from_user(&val, argp, sizeof(int));
if (i)
return -EFAULT;
pretimeout = val;
return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
case WDIOC_GET_PRETIMEOUT:
i = copy_to_user((void *) arg,
&pretimeout,
sizeof(pretimeout));
i = copy_to_user(argp, &pretimeout, sizeof(pretimeout));
if (i)
return -EFAULT;
return 0;
......@@ -557,7 +554,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
return ipmi_heartbeat();
case WDIOC_SETOPTIONS:
i = copy_from_user(&val, (void *) arg, sizeof(int));
i = copy_from_user(&val, argp, sizeof(int));
if (i)
return -EFAULT;
if (val & WDIOS_DISABLECARD)
......@@ -576,7 +573,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
case WDIOC_GETSTATUS:
val = 0;
i = copy_to_user((void *) arg, &val, sizeof(val));
i = copy_to_user(argp, &val, sizeof(val));
if (i)
return -EFAULT;
return 0;
......@@ -587,7 +584,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
}
static ssize_t ipmi_write(struct file *file,
const char *buf,
const char __user *buf,
size_t len,
loff_t *ppos)
{
......@@ -607,7 +604,7 @@ static ssize_t ipmi_write(struct file *file,
}
static ssize_t ipmi_read(struct file *file,
char *buf,
char __user *buf,
size_t count,
loff_t *ppos)
{
......
......@@ -488,7 +488,7 @@ int ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2);
/* Messages sent to the interface are this format. */
struct ipmi_req
{
unsigned char *addr; /* Address to send the message to. */
unsigned char __user *addr; /* Address to send the message to. */
unsigned int addr_len;
long msgid; /* The sequence number for the message. This
......@@ -539,7 +539,7 @@ struct ipmi_recv
int recv_type; /* Is this a command, response or an
asyncronous event. */
unsigned char *addr; /* Address the message was from is put
unsigned char __user *addr; /* Address the message was from is put
here. The caller must supply the
memory. */
unsigned int addr_len; /* The size of the address 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