[PATCH v7 1/5] eal: add lcore info in telemetry
Stephen Hemminger
stephen at networkplumber.org
Thu Jan 26 18:03:30 CET 2023
On Thu, 26 Jan 2023 16:20:41 +0100
Robin Jarry <rjarry at 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;
;
More information about the dev
mailing list