]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
Fix addition of type field
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 20 Dec 2012 17:47:03 +0000 (18:47 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 20 Dec 2012 17:47:03 +0000 (18:47 +0100)
net/can/canethgw.c

index c851a792b63484a6951a16b3ee7382768ac2fb94..86e28efaa12fef28b13d64b65a29f4b4220ee64c 100644 (file)
@@ -61,10 +61,11 @@ static int cegw_udp_send(struct socket *udp_sock, struct can_frame *cf, struct s
 
        type = cpu_to_be16(type);
        vec[0].iov_base = &type;
+       vec[0].iov_len = sizeof(type);
        vec[1].iov_base = cf;
        vec[1].iov_len = sizeof(*cf);
 
-       err = kernel_sendmsg(udp_sock, &mh, vec, 2, sizeof(*cf));
+       err = kernel_sendmsg(udp_sock, &mh, vec, 2, sizeof(type)+sizeof(*cf));
 
        return err;
 }
@@ -114,7 +115,7 @@ static int cegw_udp2can(void *data)
                vec[1].iov_base = &cf;
                vec[1].iov_len = sizeof(cf);
                ret = kernel_recvmsg(udp_sock, &mh, vec, 2,
-                                    sizeof(cf), 0);
+                                    sizeof(type) + sizeof(cf), 0);
                if (ret != sizeof(type) + sizeof(cf))
                        break;