include: drivers: can: Fix zframe to frame conversion

can_copy_zframe_to_frame did not distinguish between the standard and
extended frames. As a result, uninitialized bits were copied to the
destination frame. This commit changes the function to use the correct
bitfields.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
Alexander Wachter 2019-10-24 13:28:33 +02:00 committed by Jukka Rissanen
commit 30ebf52a27

View file

@ -616,7 +616,8 @@ static inline void can_copy_zframe_to_frame(const struct zcan_frame *zframe,
struct can_frame *frame)
{
frame->can_id = (zframe->id_type << 31) | (zframe->rtr << 30) |
zframe->ext_id;
(zframe->id_type == CAN_STANDARD_IDENTIFIER ? zframe->std_id :
zframe->ext_id);
frame->can_dlc = zframe->dlc;
memcpy(frame->data, zframe->data, sizeof(frame->data));
}