goto error;
error = -EFAULT;
- if (copy_from_user(actions->actions, flow->actions, flow->actions_len))
+ if (copy_from_user(actions->actions,
+ (struct nlattr __user *)flow->actions,
+ flow->actions_len))
goto error_free_actions;
error = validate_actions(actions->actions, actions->actions_len);
if (error)
static int answer_query(struct sw_flow *flow, u32 query_flags,
struct odp_flow __user *ufp)
{
- struct nlattr *actions;
+ struct nlattr __user *actions;
- if (get_user(actions, &ufp->actions))
+ if (get_user(actions, (struct nlattr __user * __user *)&ufp->actions))
return -EFAULT;
return do_answer_query(flow, query_flags,
u32 i;
for (i = 0; i < flowvec->n_flows; i++) {
- struct odp_flow __user *ufp = &flowvec->flows[i];
+ struct odp_flow __user *ufp = (struct odp_flow __user *)&flowvec->flows[i];
struct odp_flow uf;
struct tbl_node *flow_node;
int error;
if (!flowvec->n_flows)
return 0;
- cbdata.uflows = flowvec->flows;
+ cbdata.uflows = (struct odp_flow __user *)flowvec->flows;
cbdata.n_flows = flowvec->n_flows;
cbdata.listed_flows = 0;
}
err = -EFAULT;
- if (copy_from_user(actions->actions, execute->actions, execute->actions_len))
+ if (copy_from_user(actions->actions,
+ (struct nlattr __user *)execute->actions, execute->actions_len))
goto error_free_actions;
err = validate_actions(actions->actions, execute->actions_len);
goto error_free_actions;
err = -EFAULT;
- if (copy_from_user(skb_put(skb, execute->length), execute->data,
+ if (copy_from_user(skb_put(skb, execute->length),
+ (const void __user *)execute->data,
execute->length))
goto error_free_skb;
if (copy_from_user(&pv, upv, sizeof pv))
return -EFAULT;
- retval = do_list_ports(dp, pv.ports, pv.n_ports);
+ retval = do_list_ports(dp, (struct odp_port __user *)pv.ports,
+ pv.n_ports);
if (retval < 0)
return retval;
__get_user(flow->flags, &compat->flags))
return -EFAULT;
- flow->actions = compat_ptr(actions);
+ flow->actions = (struct nlattr __force *)compat_ptr(actions);
return 0;
}
return error;
}
-static int compat_query_flows(struct datapath *dp, struct compat_odp_flow *flows, u32 n_flows)
+static int compat_query_flows(struct datapath *dp,
+ struct compat_odp_flow __user *flows,
+ u32 n_flows)
{
struct tbl *table = rcu_dereference(dp->table);
u32 i;
return 0;
}
-static int compat_list_flows(struct datapath *dp, struct compat_odp_flow *flows, u32 n_flows)
+static int compat_list_flows(struct datapath *dp,
+ struct compat_odp_flow __user *flows, u32 n_flows)
{
struct compat_list_flows_cbdata cbdata;
int error;
static int compat_flowvec_ioctl(struct datapath *dp, unsigned long argp,
int (*function)(struct datapath *,
- struct compat_odp_flow *,
+ struct compat_odp_flow __user *,
u32 n_flows))
{
struct compat_odp_flowvec __user *uflowvec;
__get_user(execute.length, &uexecute->length))
return -EFAULT;
- execute.actions = compat_ptr(actions);
- execute.data = compat_ptr(data);
+ execute.actions = (struct nlattr __force *)compat_ptr(actions);
+ execute.data = (const void __force *)compat_ptr(data);
return do_execute(dp, &execute);
}
copy_bytes = csum_start;
csump = (__sum16 __user *)(buf + csum_start + csum_offset);
- BUG_ON((char *)csump + sizeof(__sum16) > buf + nbytes);
+ BUG_ON((char __user *)csump + sizeof(__sum16) >
+ buf + nbytes);
put_user(csum_fold(csum), csump);
}
} else
}
if (!retval) {
- struct iovec __user iov;
+ struct iovec iov;
iov.iov_base = buf;
iov.iov_len = copy_bytes;