Patchwork [iproute] ip-address: Use correct max attribute value in print_vf_stats64()

login
register
mail settings
Submitter Phil Sutter
Date Feb. 21, 2019, 6:37 p.m.
Message ID <20190221183751.10604-1-phil@nwl.cc>
Download mbox | patch
Permalink /patch/732579/
State New
Headers show

Comments

Phil Sutter - Feb. 21, 2019, 6:37 p.m.
IFLA_VF_MAX is larger than the highest valid index in vf array.

Fixes: a1b99717c7cd7 ("Add displaying VF traffic statistics")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/ipaddress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Stephen Hemminger - Feb. 21, 2019, 10:40 p.m.
On Thu, 21 Feb 2019 19:37:51 +0100
Phil Sutter <phil@nwl.cc> wrote:

> IFLA_VF_MAX is larger than the highest valid index in vf array.
> 
> Fixes: a1b99717c7cd7 ("Add displaying VF traffic statistics")
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Good catch. It worked because VF_MAX is 12 and VF_STATS_MAX is 8.
Applied.

Patch

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index bc30d326ca0a3..139afe9d572e6 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -547,7 +547,7 @@  static void print_vf_stats64(FILE *fp, struct rtattr *vfstats)
 		return;
 	}
 
-	parse_rtattr_nested(vf, IFLA_VF_MAX, vfstats);
+	parse_rtattr_nested(vf, IFLA_VF_STATS_MAX, vfstats);
 
 	if (is_json_context()) {
 		open_json_object("stats");