new helper: memcpy_from_msg()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -858,8 +858,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
|
||||
|
||||
/* update can_frames content */
|
||||
for (i = 0; i < msg_head->nframes; i++) {
|
||||
err = memcpy_fromiovec((u8 *)&op->frames[i],
|
||||
msg->msg_iov, CFSIZ);
|
||||
err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ);
|
||||
|
||||
if (op->frames[i].can_dlc > 8)
|
||||
err = -EINVAL;
|
||||
@@ -894,8 +893,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
|
||||
op->frames = &op->sframe;
|
||||
|
||||
for (i = 0; i < msg_head->nframes; i++) {
|
||||
err = memcpy_fromiovec((u8 *)&op->frames[i],
|
||||
msg->msg_iov, CFSIZ);
|
||||
err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ);
|
||||
|
||||
if (op->frames[i].can_dlc > 8)
|
||||
err = -EINVAL;
|
||||
@@ -1024,9 +1022,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
|
||||
|
||||
if (msg_head->nframes) {
|
||||
/* update can_frames content */
|
||||
err = memcpy_fromiovec((u8 *)op->frames,
|
||||
msg->msg_iov,
|
||||
msg_head->nframes * CFSIZ);
|
||||
err = memcpy_from_msg((u8 *)op->frames, msg,
|
||||
msg_head->nframes * CFSIZ);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1072,8 +1069,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
|
||||
}
|
||||
|
||||
if (msg_head->nframes) {
|
||||
err = memcpy_fromiovec((u8 *)op->frames, msg->msg_iov,
|
||||
msg_head->nframes * CFSIZ);
|
||||
err = memcpy_from_msg((u8 *)op->frames, msg,
|
||||
msg_head->nframes * CFSIZ);
|
||||
if (err < 0) {
|
||||
if (op->frames != &op->sframe)
|
||||
kfree(op->frames);
|
||||
@@ -1209,7 +1206,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
|
||||
|
||||
can_skb_reserve(skb);
|
||||
|
||||
err = memcpy_fromiovec(skb_put(skb, CFSIZ), msg->msg_iov, CFSIZ);
|
||||
err = memcpy_from_msg(skb_put(skb, CFSIZ), msg, CFSIZ);
|
||||
if (err < 0) {
|
||||
kfree_skb(skb);
|
||||
return err;
|
||||
@@ -1285,7 +1282,7 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||
|
||||
/* read message head information */
|
||||
|
||||
ret = memcpy_fromiovec((u8 *)&msg_head, msg->msg_iov, MHSIZ);
|
||||
ret = memcpy_from_msg((u8 *)&msg_head, msg, MHSIZ);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
Reference in New Issue
Block a user