canbus: isotp: convert SF length check from ASSERT to runtime check

Convert the ISO-TP SF length check in send_sf() from __ASSERT() to a
runtime check.

Fixes: #61501

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2023-08-15 14:23:29 +02:00 committed by Martí Bolívar
commit 1b3d1e01de

View file

@ -881,7 +881,11 @@ static inline int send_sf(struct isotp_send_ctx *ctx)
frame.data[index++] = ISOTP_PCI_TYPE_SF | len; frame.data[index++] = ISOTP_PCI_TYPE_SF | len;
__ASSERT_NO_MSG(len <= ISOTP_CAN_DL - index); if (len > ISOTP_CAN_DL - index) {
LOG_ERR("SF len does not fit DL");
return -ENOSPC;
}
memcpy(&frame.data[index], data, len); memcpy(&frame.data[index], data, len);
#ifdef CONFIG_ISOTP_ENABLE_TX_PADDING #ifdef CONFIG_ISOTP_ENABLE_TX_PADDING