openvswitch: Use proper buffer size in nla_memcpy
authorHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
Mon, 28 Mar 2016 10:08:59 +0000 (18:08 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Mar 2016 15:37:14 +0000 (11:37 -0400)
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 <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/conntrack.c

index dc5eb29fe7d6754acebffb7ecf2867bf5716c134..f8a8d4390a8a5427538471ab2016e7205e1e26a4 100644 (file)
@@ -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;
 
This page took 0.026168 seconds and 5 git commands to generate.