Blame SOURCES/0009-rtnl_link-fix-off-by-one-errors-in-indexed-and-sorte.patch

2eae47
From ee037ea1bbe3e9134eab3586bbd54613f39a1693 Mon Sep 17 00:00:00 2001
2eae47
From: "Dmitry V. Levin" <ldv@altlinux.org>
2eae47
Date: Sun, 23 Dec 2018 22:12:36 +0000
2eae47
Subject: [PATCH 09/27] rtnl_link: fix off-by-one errors in indexed and sorted
2eae47
 xlat lookups
2eae47
2eae47
* rtnl_link.c (decode_nla_tun_type, decode_ifla_xdp_attached,
2eae47
decode_ifla_inet_conf, decode_ifla_inet6_flags, decode_ifla_inet6_conf,
2eae47
decode_ifla_inet6_stats, decode_ifla_inet6_icmp6_stats,
2eae47
decode_ifla_inet6_agm): Decrement xlat size by one to account
2eae47
for XLAT_END as other users of indexed and sorted xlats do.
2eae47
2eae47
Fixes: v4.25~71 "rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value"
2eae47
Fixes: v4.23~41 "rtnl_link: decode IFLA_AF_SPEC"
2eae47
Fixes: v4.23~37 "rtnl_link: implement IFLA_INFO_DATA for tun devices"
2eae47
2eae47
Conflicts:
2eae47
	rtnl_link.c
2eae47
---
2eae47
 rtnl_link.c | 16 +++++++++-------
2eae47
 1 file changed, 9 insertions(+), 7 deletions(-)
2eae47
2eae47
diff --git a/rtnl_link.c b/rtnl_link.c
2eae47
index 1fbfd26..8e02bc7 100644
2eae47
--- a/rtnl_link.c
2eae47
+++ b/rtnl_link.c
2eae47
@@ -356,7 +356,7 @@ decode_nla_tun_type(struct tcb *const tcp,
2eae47
 {
2eae47
 	const struct decode_nla_xlat_opts opts = {
2eae47
 		.xlat = tun_device_types,
2eae47
-		.xlat_size = ARRAY_SIZE(tun_device_types),
2eae47
+		.xlat_size = ARRAY_SIZE(tun_device_types) - 1,
2eae47
 		.xt = XT_INDEXED,
2eae47
 		.dflt = "IFF_???",
2eae47
 		.size = 1,
2eae47
@@ -626,7 +626,8 @@ decode_ifla_inet_conf(struct tcb *const tcp,
2eae47
 	print_array_ex(tcp, addr, cnt, &elem, sizeof(elem),
2eae47
 		       tfetch_mem, print_int32_array_member, NULL,
2eae47
 		       PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
2eae47
-			| XLAT_STYLE_FMT_D, ARRSZ_PAIR(inet_devconf_indices),
2eae47
+			| XLAT_STYLE_FMT_D,
2eae47
+		       ARRSZ_PAIR(inet_devconf_indices) - 1,
2eae47
 		       "IPV4_DEVCONF_???");
2eae47
 
2eae47
 	return true;
2eae47
@@ -643,7 +644,7 @@ decode_ifla_inet6_flags(struct tcb *const tcp,
2eae47
 		        const void *const opaque_data)
2eae47
 {
2eae47
 	const struct decode_nla_xlat_opts opts = {
2eae47
-		ARRSZ_PAIR(inet6_if_flags), "IF_???",
2eae47
+		ARRSZ_PAIR(inet6_if_flags) - 1, "IF_???",
2eae47
 		.size = 4,
2eae47
 	};
2eae47
 
2eae47
@@ -665,7 +666,8 @@ decode_ifla_inet6_conf(struct tcb *const tcp,
2eae47
 	print_array_ex(tcp, addr, cnt, &elem, sizeof(elem),
2eae47
 		       tfetch_mem, print_int32_array_member, NULL,
2eae47
 		       PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
2eae47
-			| XLAT_STYLE_FMT_D, ARRSZ_PAIR(inet6_devconf_indices),
2eae47
+			| XLAT_STYLE_FMT_D,
2eae47
+		       ARRSZ_PAIR(inet6_devconf_indices) - 1,
2eae47
 		       "DEVCONF_???");
2eae47
 
2eae47
 	return true;
2eae47
@@ -686,7 +688,7 @@ decode_ifla_inet6_stats(struct tcb *const tcp,
2eae47
 	print_array_ex(tcp, addr, cnt, &elem, sizeof(elem),
2eae47
 		       tfetch_mem, print_uint64_array_member, NULL,
2eae47
 		       PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
2eae47
-			| XLAT_STYLE_FMT_U, ARRSZ_PAIR(snmp_ip_stats),
2eae47
+			| XLAT_STYLE_FMT_U, ARRSZ_PAIR(snmp_ip_stats) - 1,
2eae47
 		       "IPSTATS_MIB_???");
2eae47
 
2eae47
 	return true;
2eae47
@@ -733,7 +735,7 @@ decode_ifla_inet6_icmp6_stats(struct tcb *const tcp,
2eae47
 	print_array_ex(tcp, addr, cnt, &elem, sizeof(elem),
2eae47
 		       tfetch_mem, print_uint64_array_member, NULL,
2eae47
 		       PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
2eae47
-			| XLAT_STYLE_FMT_U, ARRSZ_PAIR(snmp_icmp6_stats),
2eae47
+			| XLAT_STYLE_FMT_U, ARRSZ_PAIR(snmp_icmp6_stats) - 1,
2eae47
 		       "ICMP6_MIB_???");
2eae47
 
2eae47
 	return true;
2eae47
@@ -762,7 +764,7 @@ decode_ifla_inet6_agm(struct tcb *const tcp,
2eae47
 		      const void *const opaque_data)
2eae47
 {
2eae47
 	const struct decode_nla_xlat_opts opts = {
2eae47
-		ARRSZ_PAIR(in6_addr_gen_mode), "IN6_ADDR_GEN_MODE_???",
2eae47
+		ARRSZ_PAIR(in6_addr_gen_mode) - 1, "IN6_ADDR_GEN_MODE_???",
2eae47
 		.xt = XT_INDEXED,
2eae47
 		.size = 1,
2eae47
 	};
2eae47
-- 
2eae47
2.1.4
2eae47