On Thu, Jan 13, 2022 at 04:54:54PM +0100, Miroslav Lichvar wrote: > Initialize the whole array passed to rtnl_rtattr_parse() and don't > ignore the last attribute with the maximum value. This will be needed to > get the ETHTOOL_A_PHC_VCLOCKS_INDEX attribute. > > Signed-off-by: Miroslav Lichvar <mlich...@redhat.com> > Cc: Hangbin Liu <liuhang...@gmail.com> > --- > rtnl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/rtnl.c b/rtnl.c > index fe625d6..88a749f 100644 > --- a/rtnl.c > +++ b/rtnl.c > @@ -178,10 +178,10 @@ static int rtnl_rtattr_parse(struct rtattr *tb[], int > max, struct rtattr *rta, i > { > unsigned short type; > > - memset(tb, 0, sizeof(struct rtattr *) * max); > + memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); > while (RTA_OK(rta, len)) { > type = rta->rta_type; > - if ((type < max) && (!tb[type])) > + if ((type <= max) && (!tb[type])) > tb[type] = rta; > rta = RTA_NEXT(rta, len); > } > -- > 2.33.1 >
Acked-by: Hangbin Liu <liuhang...@gmail.com> _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel