diff options
Diffstat (limited to 'net/can/bcm.c')
-rw-r--r-- | net/can/bcm.c | 4 |
1 files changed, 2 insertions, 2 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 | } |