From: Haishuang Yan Date: Mon, 28 Mar 2016 10:08:59 +0000 (+0800) Subject: openvswitch: Use proper buffer size in nla_memcpy X-Git-Tag: v4.6-rc2~9^2~30 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ac71b46efd2838c02ec193987c8f61c3ba33b495;p=karo-tx-linux.git openvswitch: Use proper buffer size in nla_memcpy For the input parameter count, it's better to use the size of destination buffer size, as nla_memcpy would take into account the length of the source netlink attribute when a data is copied from an attribute. Signed-off-by: Haishuang Yan Signed-off-by: David S. Miller --- diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index dc5eb29fe7d6..f8a8d4390a8a 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -968,7 +968,8 @@ static int parse_nat(const struct nlattr *attr, break; case OVS_NAT_ATTR_IP_MIN: - nla_memcpy(&info->range.min_addr, a, nla_len(a)); + nla_memcpy(&info->range.min_addr, a, + sizeof(info->range.min_addr)); info->range.flags |= NF_NAT_RANGE_MAP_IPS; break;