netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Wojciech Drewek <wojciech.drewek@intel.com>
Cc: netdev@vger.kernel.org, dsahern@gmail.com,
	michal.swiatkowski@linux.intel.com,
	marcin.szycik@linux.intel.com
Subject: Re: [PATCH iproute2-next v2 2/2] f_flower: Implement gtp options support
Date: Fri, 4 Feb 2022 10:20:58 -0800	[thread overview]
Message-ID: <20220204102058.7f237f80@hermes.local> (raw)
In-Reply-To: <20220204165821.12104-3-wojciech.drewek@intel.com>

On Fri,  4 Feb 2022 17:58:21 +0100
Wojciech Drewek <wojciech.drewek@intel.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.

      reply	other threads:[~2022-02-04 18:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 16:58 [PATCH iproute2-next v2 0/2] GTP support for ip link and tc flower Wojciech Drewek
2022-02-04 16:58 ` [PATCH iproute2-next v2 1/2] ip: GTP support in ip link Wojciech Drewek
2022-02-04 18:18   ` Stephen Hemminger
2022-02-04 16:58 ` [PATCH iproute2-next v2 2/2] f_flower: Implement gtp options support Wojciech Drewek
2022-02-04 18:20   ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220204102058.7f237f80@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dsahern@gmail.com \
    --cc=marcin.szycik@linux.intel.com \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=wojciech.drewek@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).