summaryrefslogtreecommitdiffstats
path: root/net/can/bcm.c
diff options
context:
space:
mode:
authorKurt Van Dijck <dev.kurt@vandijck-laurijssen.be>2018-10-08 11:48:33 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2019-09-04 13:29:15 +0200
commit9868b5d44f3df9dd75247acd23dddff0a42f79be (patch)
treec12df929a819d45fab12295ea93c3c5d4d00aa10 /net/can/bcm.c
parentmailmap: update email address (diff)
downloadlinux-9868b5d44f3df9dd75247acd23dddff0a42f79be.tar.xz
linux-9868b5d44f3df9dd75247acd23dddff0a42f79be.zip
can: introduce CAN_REQUIRED_SIZE macro
The size of this structure will be increased with J1939 support. To stay binary compatible, the CAN_REQUIRED_SIZE macro is introduced for existing CAN protocols. Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/bcm.c')
-rw-r--r--net/can/bcm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 28fd1a1c8487..c96fa0f33db3 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1294,7 +1294,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
/* no bound device as default => check msg_name */
DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name);
- if (msg->msg_namelen < sizeof(*addr))
+ if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex))
return -EINVAL;
if (addr->can_family != AF_CAN)
@@ -1536,7 +1536,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
struct net *net = sock_net(sk);
int ret = 0;
- if (len < sizeof(*addr))
+ if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex))
return -EINVAL;
lock_sock(sk);