vec[1].iov_len = sizeof(cf);
ret = kernel_recvmsg(udp_sock, &mh, vec, 2,
sizeof(type) + sizeof(cf), 0);
- if (ret != sizeof(type) + sizeof(cf))
+ if (ret == 0)
break;
+ if (ret != sizeof(type) + sizeof(cf)) {
+ pr_notice_ratelimited("canethgw: UDP length mismatch\n");
+ continue;
+ }
type = be16_to_cpu(type);
switch (type) {
case CAN_FRAME:
cf.can_id = be32_to_cpu(cf.can_id);
cegw_can_send(can_sock, &cf);
- default:;
+ break;
+ default:
+ pr_notice_ratelimited("canethgw: Unknown message type\n");
}
}