Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1365427

[PATCH] openvswitch: Use proper buffer size in nla_memcpy

From Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Newsgroups linux.kernel
Subject [PATCH] openvswitch: Use proper buffer size in nla_memcpy
Date 2016-03-28 12:10 +0200
Message-ID <rhCht-5v5-27@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 net/openvswitch/conntrack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index dc5eb29..f8a8d43 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;
 
-- 
1.8.3.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] openvswitch: Use proper buffer size in nla_memcpy Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2016-03-28 12:10 +0200
  Re: [PATCH] openvswitch: Use proper buffer size in nla_memcpy David Miller <davem@davemloft.net> - 2016-03-28 17:40 +0200

csiph-web