On Wed, Jan 23, 2019 at 12:47 PM Stephen Hemminger <step...@networkplumber.org> wrote: > > On Thu, 17 Jan 2019 13:18:55 -0800 > Cong Wang <xiyou.wangc...@gmail.com> wrote: > > > > > + if (tb[TCA_MATCHALL_PCNT]) { > > + if (RTA_PAYLOAD(tb[TCA_MATCHALL_PCNT]) < sizeof(*pf)) { > > + print_string(PRINT_FP, NULL, "Broken perf > > counters\n", NULL); > > This the wrong way to print an error message with iproute2 suite. > The correct answer is simple. > fprintf(stderr, "Broken perf counters\n"); > and better yet give a more informative message that says what is incorrect.
What's your suggestion? In fact, I am not sure if we really have to check the size here, it should be safe to assume kernel will always dump a non-broken struct here, and this struct will never shrink.