On Tue, 31 Jan 2023 10:40:08 +0100 "Robin Jarry" <rja...@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.