[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220204102058.7f237f80@hermes.local>
Date: Fri, 4 Feb 2022 10:20:58 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Wojciech Drewek <wojciech.drewek@...el.com>
Cc: netdev@...r.kernel.org, dsahern@...il.com,
michal.swiatkowski@...ux.intel.com, marcin.szycik@...ux.intel.com
Subject: Re: [PATCH iproute2-next v2 2/2] f_flower: Implement gtp options
support
On Fri, 4 Feb 2022 17:58:21 +0100
Wojciech Drewek <wojciech.drewek@...el.com> wrote:
> +static void flower_print_gtp_opts(const char *name, struct rtattr *attr,
> + char *strbuf)
> +{
> + struct rtattr *tb[TCA_FLOWER_KEY_ENC_OPT_GTP_MAX + 1];
> + __u8 pdu_type, qfi;
> +
> + parse_rtattr(tb, TCA_FLOWER_KEY_ENC_OPT_GTP_MAX, RTA_DATA(attr),
> + RTA_PAYLOAD(attr));
> +
> + pdu_type = rta_getattr_u8(tb[TCA_FLOWER_KEY_ENC_OPT_GTP_PDU_TYPE]);
> + qfi = rta_getattr_u8(tb[TCA_FLOWER_KEY_ENC_OPT_GTP_QFI]);
> +
> + sprintf(strbuf, "%02x:%02x", pdu_type, qfi);
> +}
Better to use snprintf and pass length parameter.
You are ok now, but someday this might grow.
Powered by blists - more mailing lists