[PATCH v7 1/5] eal: add lcore info in telemetry

Stephen Hemminger stephen at networkplumber.org
Tue Jan 31 17:41:41 CET 2023


On Tue, 31 Jan 2023 10:40:08 +0100
"Robin Jarry" <rjarry at redhat.com> wrote:

> Hi Stephen,
> 
> Stephen Hemminger, Jan 26, 2023 at 18:03:
> > 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;  
> 
> Ok that may be more exhaustive. But even if the lcore_id is out of 
> range, it will not be matched by the callback.
> 
> Do you think it warrants sending a v8 of the whole series just for this?


The reason for the range check is to avoid wraparound.
Actually, you need a temp variable there since lcore_id is
uint16_t and unsigned long is 64 bits on most platforms.


More information about the dev mailing list