Skip to content

Commit

Permalink
can-isotp: introduce CAN_REQUIRED_SIZE macro
Browse files Browse the repository at this point in the history
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.

Follow upstream commit 9868b5d44f3d ("can: introduce CAN_REQUIRED_SIZE macro")

Signed-off-by: Oliver Hartkopp <[email protected]>
  • Loading branch information
hartkopp committed Jan 15, 2020
1 parent b31bce9 commit fbed98a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/can/isotp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,11 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
int err = 0;
int notify_enetdown = 0;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex))
#else
if (len < sizeof(*addr))
#endif
return -EINVAL;

if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id)
Expand Down

0 comments on commit fbed98a

Please sign in to comment.