Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32686a9d authored by Thomas Graf's avatar Thomas Graf Committed by Jesse Gross
Browse files

openvswitch: 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: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarJesse Gross <jesse@nicira.com>
parent dded45fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -672,7 +672,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);
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ struct sw_flow_actions *ovs_flow_actions_alloc(const struct nlattr *actions)
		return ERR_PTR(-ENOMEM);

	sfa->actions_len = actions_len;
	memcpy(sfa->actions, nla_data(actions), actions_len);
	nla_memcpy(sfa->actions, actions, actions_len);
	return sfa;
}