datapath: Use nla_memcpy() to memcpy() data from attributes
authorThomas Graf <tgraf@suug.ch>
Sat, 30 Mar 2013 01:10:31 +0000 (18:10 -0700)
committerJesse Gross <jesse@nicira.com>
Sat, 30 Mar 2013 01:10:31 +0000 (18:10 -0700)
Less error prone as it takes into account the length of both the
destination buffer and the source attribute and documents when
data is copied from an attribute.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/datapath.c

index 076aa98..aae507d 100644 (file)
@@ -825,7 +825,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
                goto err;
        skb_reserve(packet, NET_IP_ALIGN);
 
-       memcpy(__skb_put(packet, len), nla_data(a[OVS_PACKET_ATTR_PACKET]), len);
+       nla_memcpy(__skb_put(packet, len), a[OVS_PACKET_ATTR_PACKET], len);
 
        skb_reset_mac_header(packet);
        eth = eth_hdr(packet);