diff options
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/bcm.c | 4 | ||||
-rw-r--r-- | net/can/raw.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c index 46f20bfafc0e..3fc737b214c7 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -1256,8 +1256,7 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1256 | 1256 | ||
1257 | if (!ifindex && msg->msg_name) { | 1257 | if (!ifindex && msg->msg_name) { |
1258 | /* no bound device as default => check msg_name */ | 1258 | /* no bound device as default => check msg_name */ |
1259 | struct sockaddr_can *addr = | 1259 | DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); |
1260 | (struct sockaddr_can *)msg->msg_name; | ||
1261 | 1260 | ||
1262 | if (msg->msg_namelen < sizeof(*addr)) | 1261 | if (msg->msg_namelen < sizeof(*addr)) |
1263 | return -EINVAL; | 1262 | return -EINVAL; |
@@ -1568,6 +1567,7 @@ static int bcm_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1568 | sock_recv_ts_and_drops(msg, sk, skb); | 1567 | sock_recv_ts_and_drops(msg, sk, skb); |
1569 | 1568 | ||
1570 | if (msg->msg_name) { | 1569 | if (msg->msg_name) { |
1570 | __sockaddr_check_size(sizeof(struct sockaddr_can)); | ||
1571 | msg->msg_namelen = sizeof(struct sockaddr_can); | 1571 | msg->msg_namelen = sizeof(struct sockaddr_can); |
1572 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); | 1572 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); |
1573 | } | 1573 | } |
diff --git a/net/can/raw.c b/net/can/raw.c index 641e1c895123..07d72d852324 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -675,8 +675,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
675 | int err; | 675 | int err; |
676 | 676 | ||
677 | if (msg->msg_name) { | 677 | if (msg->msg_name) { |
678 | struct sockaddr_can *addr = | 678 | DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); |
679 | (struct sockaddr_can *)msg->msg_name; | ||
680 | 679 | ||
681 | if (msg->msg_namelen < sizeof(*addr)) | 680 | if (msg->msg_namelen < sizeof(*addr)) |
682 | return -EINVAL; | 681 | return -EINVAL; |
@@ -775,6 +774,7 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
775 | sock_recv_ts_and_drops(msg, sk, skb); | 774 | sock_recv_ts_and_drops(msg, sk, skb); |
776 | 775 | ||
777 | if (msg->msg_name) { | 776 | if (msg->msg_name) { |
777 | __sockaddr_check_size(sizeof(struct sockaddr_can)); | ||
778 | msg->msg_namelen = sizeof(struct sockaddr_can); | 778 | msg->msg_namelen = sizeof(struct sockaddr_can); |
779 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); | 779 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); |
780 | } | 780 | } |