All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Robin Jarry <rjarry@redhat.com>
Cc: dev@dpdk.org, "Morten Brørup" <mb@smartsharesystems.com>,
	"Kevin Laatz" <kevin.laatz@intel.com>
Subject: Re: [PATCH v7 1/5] eal: add lcore info in telemetry
Date: Thu, 26 Jan 2023 09:03:30 -0800	[thread overview]
Message-ID: <20230126090330.13014fbf@hermes.local> (raw)
In-Reply-To: <20230126152045.1036904-2-rjarry@redhat.com>

On Thu, 26 Jan 2023 16:20:41 +0100
Robin Jarry <rjarry@redhat.com> wrote:

> +	struct lcore_telemetry_info info = { .d = d };
> +	char *endptr = NULL;
> +
> +	if (params == NULL || strlen(params) == 0)
> +		return -EINVAL;
> +	errno = 0;
> +	info.lcore_id = strtoul(params, &endptr, 10);
> +	if (errno)
> +		return -errno;
> +	if (endptr == params)
> +		return -EINVAL;

Alternatively, you could should check for lcore out of range.


Simplified as:
	struct lcore_telemetry_info info = { .d = d };
	char *endptr;  // init not really needed

	if (params == NULL)  // length check can be handled later
		return -EINVAL;

	info.lcore_id = strtoul(params, &endptr, 10);

        if (*params == '\0' || *endptr != '\0 ||
            info.lcore_id >= RTE_MAX_LCORE)
               return -EINVAL;
;

  reply	other threads:[~2023-01-26 17:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 15:20 [PATCH v7 0/5] lcore telemetry improvements Robin Jarry
2023-01-26 15:20 ` [PATCH v7 1/5] eal: add lcore info in telemetry Robin Jarry
2023-01-26 17:03   ` Stephen Hemminger [this message]
2023-01-31  9:40     ` Robin Jarry
2023-01-31 16:41       ` Stephen Hemminger
2023-01-26 15:20 ` [PATCH v7 2/5] eal: report applications lcore usage Robin Jarry
2023-01-26 15:20 ` [PATCH v7 3/5] app/testpmd: add dump command for lcores Robin Jarry
2023-01-26 15:20 ` [PATCH v7 4/5] app/testpmd: report lcore usage Robin Jarry
2023-01-26 15:20 ` [PATCH v7 5/5] eal: add lcore usage telemetry endpoint Robin Jarry

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=20230126090330.13014fbf@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=kevin.laatz@intel.com \
    --cc=mb@smartsharesystems.com \
    --cc=rjarry@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.