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.hu...@huawei.com>
>> Signed-off-by: Hao Chen <chenhao...@huawei.com>
>> Signed-off-by: Chunsong Feng <fengchuns...@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humi...@huawei.com>
>> Signed-off-by: Huisong Li <lihuis...@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
>
>