From: Thomas Graf Date: Sat, 30 Mar 2013 01:10:31 +0000 (-0700) Subject: datapath: Use nla_memcpy() to memcpy() data from attributes X-Git-Tag: sliver-openvswitch-1.10.90-1~10^2~17 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=bf3d6fce9472742bc69939898ad4f0e1c97d69e6;hp=7c3072cc440eb76f1960c2a914d9d7c87fe71ee3;p=sliver-openvswitch.git datapath: Use nla_memcpy() to memcpy() data from attributes 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 Signed-off-by: Jesse Gross --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 076aa98be..aae507d71 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -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);