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

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