[dpdk-dev] [PATCH 19/22] net/hns3: add stats related ops for hns3 PMD driver

Wei Hu (Xavier) xavier.huwei at huawei.com
Sat Aug 31 10:49:17 CEST 2019



On 2019/8/30 23:20, Ferruh Yigit wrote:
> On 8/23/2019 2:47 PM, Wei Hu (Xavier) wrote:
>> This patch adds stats_get, stats_reset, xstats_get, xstats_get_names
>> xstats_reset, xstats_get_by_id and xstats_get_names_by_id related
>> function codes.
>>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
>> Signed-off-by: Hao Chen <chenhao164 at huawei.com>
>> Signed-off-by: Chunsong Feng <fengchunsong at huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
>> Signed-off-by: Huisong Li <lihuisong at huawei.com>
> <...>
>
>> +	for (i = 0; i < size; i++) {
>> +		if (ids[i] >= cnt_stats) {
>> +			PMD_INIT_LOG(ERR, "id value is invalid");
>> +			return -EINVAL;
>> +		}
>> +		strncpy(xstats_names[i].name, xstats_names_copy[ids[i]].name,
>> +			strlen(xstats_names_copy[ids[i]].name));
> Getting following warning from this line:
>
> .../drivers/net/hns3/hns3_stats.c: In function
> ‘hns3_dev_xstats_get_names_by_id’:
>
> .../drivers/net/hns3/hns3_stats.c:825:3: error: ‘strncpy’ output truncated
> before terminating nul copying as many bytes from a string as its length
> [-Werror=stringop-truncation]
>   825 |   strncpy(xstats_names[i].name, xstats_names_copy[ids[i]].name,
>
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   826 |    strlen(xstats_names_copy[ids[i]].name));
>
>       |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi, Ferruh Yigit
    Thanks for your comments,
    We will fix it in patch V2.

    Regards
Xavier
>
>




More information about the dev mailing list