On 2025/8/7 11:15, Stephen Hemminger wrote:
> On Thu, 7 Aug 2025 10:49:36 +0800
> Dengdui Huang <huangdeng...@huawei.com> wrote:
> 
>> diff --git a/lib/eal/common/eal_common_launch.c 
>> b/lib/eal/common/eal_common_launch.c
>> index a7deac6ecd..be7226e4b6 100644
>> --- a/lib/eal/common/eal_common_launch.c
>> +++ b/lib/eal/common/eal_common_launch.c
>> @@ -36,8 +36,15 @@ RTE_EXPORT_SYMBOL(rte_eal_remote_launch)
>>  int
>>  rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int 
>> worker_id)
>>  {
>> +    enum rte_lcore_role_t role;
>>      int rc = -EBUSY;
>>  
>> +    role = lcore_config[worker_id].core_role;
>> +    if (role != ROLE_RTE && role != ROLE_SERVICE) {
>> +            rc = -EINVAL;
>> +            goto finish;
>> +    }
> 
> worker_id could be any value, if it was out of the range of the array
> you would end up reading junk.

The lcore should not exceed the RTE_MAX_LCORE range, which should be a common 
understanding everyone.
I believe checking it in the code is redundant, updating the documentation be a 
better solution.

Moreover, in some interfaces[1], if the lore exceeds the RTE_MAX_LCORE range, 
it is difficult to determine what value should be returned.

[1] 
https://elixir.bootlin.com/dpdk/v25.07/source/lib/eal/include/rte_launch.h#L112

Reply via email to