From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02A7041DBF for ; Thu, 9 Mar 2023 10:03:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7483D427F5; Thu, 9 Mar 2023 10:03:28 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id E0FDC41611 for ; Thu, 9 Mar 2023 10:03:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678352606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ds1PQd3/352lfPcVb++2/frHXu+UUjSqwY3fWdyuhEE=; b=ZuPm8Y/iGkGSQi08+ubQxDsQ9w20HpgKWFbzu5KvxyY+KYnl1QrN6Zn6foa/bu0pSKojt3 s84297WR3dYPiyyba20QTTbC/TMD88o1tnNhAv3CuGSTWvWbbmOq5ahrKsYf24LQBhqhGn jNm22A9pocXSb4FjMTwu2VnJkaNMNfQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-wY6GAotoN5ySTBhPam62Aw-1; Thu, 09 Mar 2023 04:03:22 -0500 X-MC-Unique: wY6GAotoN5ySTBhPam62Aw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAB2185A588; Thu, 9 Mar 2023 09:03:21 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B0D82166B26; Thu, 9 Mar 2023 09:03:20 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH] net/mlx5: fix build with GCC 12 and ASan Date: Thu, 9 Mar 2023 10:03:17 +0100 Message-Id: <20230309090317.847742-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Building with gcc 12 and ASan raises this warning: ../drivers/net/mlx5/mlx5_txpp.c: In function ‘mlx5_txpp_xstats_get_names’: ../drivers/net/mlx5/mlx5_txpp.c:1066:25: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation] 1066 | strncpy(xstats_names[i + n_used].name, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1067 | mlx5_txpp_stat_names[i], | ~~~~~~~~~~~~~~~~~~~~~~~~ 1068 | RTE_ETH_XSTATS_NAME_SIZE); | ~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Prefer strlcpy. Fixes: 3b025c0ca425 ("net/mlx5: provide send scheduling error statistics") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/mlx5/mlx5_txpp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c index 63d98dbde9..0e1da1d5f5 100644 --- a/drivers/net/mlx5/mlx5_txpp.c +++ b/drivers/net/mlx5/mlx5_txpp.c @@ -1063,11 +1063,9 @@ int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev __rte_unused, if (n >= n_used + n_txpp && xstats_names) { for (i = 0; i < n_txpp; ++i) { - strncpy(xstats_names[i + n_used].name, + strlcpy(xstats_names[i + n_used].name, mlx5_txpp_stat_names[i], RTE_ETH_XSTATS_NAME_SIZE); - xstats_names[i + n_used].name - [RTE_ETH_XSTATS_NAME_SIZE - 1] = 0; } } return n_used + n_txpp; -- 2.39.2