Blob Blame History Raw
From def46773e2540b4898b26c470d8d658b4b39075f Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Sun, 23 Dec 2018 22:12:36 +0000
Subject: [PATCH 07/27] nlattr: fix off-by-one error in indexed xlat lookup

* nlattr.c (decode_nla_meminfo): Decrement xlat size by one
to account for XLAT_END as other users of indexed xlats do.

Fixes: v4.23~89 "nlattr: print index names in netlink meminfo array"
---
 nlattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nlattr.c b/nlattr.c
index af7cc16..db37452 100644
--- a/nlattr.c
+++ b/nlattr.c
@@ -217,7 +217,7 @@ decode_nla_meminfo(struct tcb *const tcp,
 		       tfetch_mem, print_uint32_array_member, &count,
 		       PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
 			| XLAT_STYLE_FMT_U,
-		       ARRSZ_PAIR(netlink_sk_meminfo_indices),
+		       ARRSZ_PAIR(netlink_sk_meminfo_indices) - 1,
 		       "SK_MEMINFO_???");
 
 	return true;
-- 
2.1.4