aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-04-06 21:25:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-11-24 04:28:48 -0500
commit6ce8e9ce5989ae13f493062975304700be86d20e (patch)
treeb714f34723d37ccd90bb5350555cbfe9dc8b9abe /net/can
parent227158db160449b6513d2e31894a135104b90e90 (diff)
new helper: memcpy_from_msg()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/bcm.c19
-rw-r--r--net/can/raw.c2
2 files changed, 9 insertions, 12 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c
index dcb75c0e66c1..b9a1f715df18 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -858,8 +858,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
858 858
859 /* update can_frames content */ 859 /* update can_frames content */
860 for (i = 0; i < msg_head->nframes; i++) { 860 for (i = 0; i < msg_head->nframes; i++) {
861 err = memcpy_fromiovec((u8 *)&op->frames[i], 861 err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ);
862 msg->msg_iov, CFSIZ);
863 862
864 if (op->frames[i].can_dlc > 8) 863 if (op->frames[i].can_dlc > 8)
865 err = -EINVAL; 864 err = -EINVAL;
@@ -894,8 +893,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
894 op->frames = &op->sframe; 893 op->frames = &op->sframe;
895 894
896 for (i = 0; i < msg_head->nframes; i++) { 895 for (i = 0; i < msg_head->nframes; i++) {
897 err = memcpy_fromiovec((u8 *)&op->frames[i], 896 err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ);
898 msg->msg_iov, CFSIZ);
899 897
900 if (op->frames[i].can_dlc > 8) 898 if (op->frames[i].can_dlc > 8)
901 err = -EINVAL; 899 err = -EINVAL;
@@ -1024,9 +1022,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1024 1022
1025 if (msg_head->nframes) { 1023 if (msg_head->nframes) {
1026 /* update can_frames content */ 1024 /* update can_frames content */
1027 err = memcpy_fromiovec((u8 *)op->frames, 1025 err = memcpy_from_msg((u8 *)op->frames, msg,
1028 msg->msg_iov, 1026 msg_head->nframes * CFSIZ);
1029 msg_head->nframes * CFSIZ);
1030 if (err < 0) 1027 if (err < 0)
1031 return err; 1028 return err;
1032 1029
@@ -1072,8 +1069,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1072 } 1069 }
1073 1070
1074 if (msg_head->nframes) { 1071 if (msg_head->nframes) {
1075 err = memcpy_fromiovec((u8 *)op->frames, msg->msg_iov, 1072 err = memcpy_from_msg((u8 *)op->frames, msg,
1076 msg_head->nframes * CFSIZ); 1073 msg_head->nframes * CFSIZ);
1077 if (err < 0) { 1074 if (err < 0) {
1078 if (op->frames != &op->sframe) 1075 if (op->frames != &op->sframe)
1079 kfree(op->frames); 1076 kfree(op->frames);
@@ -1209,7 +1206,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
1209 1206
1210 can_skb_reserve(skb); 1207 can_skb_reserve(skb);
1211 1208
1212 err = memcpy_fromiovec(skb_put(skb, CFSIZ), msg->msg_iov, CFSIZ); 1209 err = memcpy_from_msg(skb_put(skb, CFSIZ), msg, CFSIZ);
1213 if (err < 0) { 1210 if (err < 0) {
1214 kfree_skb(skb); 1211 kfree_skb(skb);
1215 return err; 1212 return err;
@@ -1285,7 +1282,7 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock,
1285 1282
1286 /* read message head information */ 1283 /* read message head information */
1287 1284
1288 ret = memcpy_fromiovec((u8 *)&msg_head, msg->msg_iov, MHSIZ); 1285 ret = memcpy_from_msg((u8 *)&msg_head, msg, MHSIZ);
1289 if (ret < 0) 1286 if (ret < 0)
1290 return ret; 1287 return ret;
1291 1288
diff --git a/net/can/raw.c b/net/can/raw.c
index 081e81fd017f..0e4004fb6876 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -703,7 +703,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
703 can_skb_reserve(skb); 703 can_skb_reserve(skb);
704 can_skb_prv(skb)->ifindex = dev->ifindex; 704 can_skb_prv(skb)->ifindex = dev->ifindex;
705 705
706 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); 706 err = memcpy_from_msg(skb_put(skb, size), msg, size);
707 if (err < 0) 707 if (err < 0)
708 goto free_skb; 708 goto free_skb;
709 709