From: Stephen Hemminger <stephen@networkplumber.org>
To: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk>
Cc: Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
Aman Singh <aman.deep.singh@intel.com>,
Sunil Kumar Kori <skori@marvell.com>,
dev@dpdk.org, stable@dpdk.org
Subject: Re: [PATCH v2] app/testpmd: validate dscp and vlan table entries for meter creation
Date: Wed, 27 Aug 2025 09:05:04 -0700 [thread overview]
Message-ID: <20250827090504.7ae3b66a@hermes.local> (raw)
In-Reply-To: <20250827111837.3882892-1-14pwcse1224@uetpeshawar.edu.pk>
On Wed, 27 Aug 2025 07:18:37 -0400
Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> wrote:
>
> +static int
> +validate_input_color_table_entries(char *str)
> +{
> + char *token = strtok_r(str, PARSE_DELIMITER, &str);
> + for (int i = 0; token != NULL; i++) {
> + if (i > ((MAX_DSCP_TABLE_ENTRIES + MAX_VLAN_TABLE_ENTRIES) - 1))
> + return -1;
> + token = strtok_r(str, PARSE_DELIMITER, &str);
> + }
> + return 0;
> +}
The loop doesn't look right, it is looking form next deliminator at
the start of the list? Normally strtok_r is used with a different pointer
as the "saveptr".
From man page.
The strtok_r() function is a reentrant version of strtok(). The saveptr argument is a
pointer to a char * variable that is used internally by strtok_r() in order to maintain con‐
text between successive calls that parse the same string.
On the first call to strtok_r(), str should point to the string to be parsed, and the value
of *saveptr is ignored (but see VERSIONS). In subsequent calls, str should be NULL, and
saveptr (and the buffer that it points to) should be unchanged since the previous call.
prev parent reply other threads:[~2025-08-27 16:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 12:14 [PATCH] " Khadem Ullah
2025-08-26 14:00 ` Stephen Hemminger
2025-08-27 11:18 ` [PATCH v2] " Khadem Ullah
2025-08-27 16:05 ` 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=20250827090504.7ae3b66a@hermes.local \
--to=stephen@networkplumber.org \
--cc=14pwcse1224@uetpeshawar.edu.pk \
--cc=aman.deep.singh@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=skori@marvell.com \
--cc=stable@dpdk.org \
/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).