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 B365B42C04; Thu, 1 Jun 2023 17:04:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01AD942F94; Thu, 1 Jun 2023 17:01:38 +0200 (CEST) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mails.dpdk.org (Postfix) with ESMTP id A4DEF42DBC for ; Thu, 1 Jun 2023 17:01:34 +0200 (CEST) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1b0201d9a9eso8160545ad.0 for ; Thu, 01 Jun 2023 08:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685631693; x=1688223693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jgRGa9fj99icTw6Fj7eUMSpK1g2HT9wjEmFLEFL4/bA=; b=xSu9HtwammUZJUsOd8kcOZoPhgCWSfjERRvFVIH96/1MGFMh7SIx/JsQ2szw5WZrib K2GLiSNyw/HAz96v80N6RR76APvLRmyGXWDxYgG6fCD6DyGtvNalAY4jb7yP+JkDArq3 gW/6qMV3/IDZeNDPKDBUfkanlfg+Way/p7fF84Xk2J2BsZLVHMCotmGwHrrMJ+j/CAUV HRhclmjSkQigY6zUfPIKBVUdVAOIuqrST8InuJcnkgepCcTFawuNnQlN6a7dIZaFcfvc eUFSlmyrGlmhPb5ztLbFDtZqBf5FHkOV6MC8Bfqn8XR9sa/6qThiz35KYi16+LT3uv7p Oehg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685631693; x=1688223693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jgRGa9fj99icTw6Fj7eUMSpK1g2HT9wjEmFLEFL4/bA=; b=AYKH7KIHkI13/Ymzs/4Yq8x/B/3Zd8naQaLN9rw3RU3vhzbTKssSHSRBC9yEREUl+H KfLOL7504GjYHavqQm6Jbc5r5Vw4+yZ0yJeCWs1KzasFKHQs1+8rbrUb0ulftu1Fyjdn 7cP66H+JurM/Apn+3mHuYCk8JbsW8/q+pIlW/79UyY6S8KTi8yb8uwwKpoZpg8nQz4Yv 00EZth7BDuCZArputCYvKp6XYj9oRnXAgjlm5EHRB0L+IprP9zT/qGgmdXdwdbpHbipc BqmZ7pbyZOUF9vBRx+js1p0Ssm0KD+q8f1jLqDE3v08U6qp4GKsvAlLAuI56XVS1+JTg ftXw== X-Gm-Message-State: AC+VfDyuLR1sSmQzDUeM1IoXw637fzy/2/9Fi46j20sPWgFtm6mRAOzG YAlL4f/PwDQ9wy3zs2x0tCAeoGzhZ0XJBQaqO9IFLg== X-Google-Smtp-Source: ACHHUZ5IroQoBo5fm39sl9qPqrLY4HkrFXej9ZZ+b5GmyFWdFWNPZBP8wyJfBtgh79JnvlRhwAAYsw== X-Received: by 2002:a17:902:ea0b:b0:1b0:56cf:b89d with SMTP id s11-20020a170902ea0b00b001b056cfb89dmr2650501plg.12.1685631693593; Thu, 01 Jun 2023 08:01:33 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id ij9-20020a170902ab4900b001ac40488620sm3661955plb.92.2023.06.01.08.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 08:01:33 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Qi Zhang , Xiao Wang , Yuying Zhang , Beilei Xing , Jingjing Wu , Qiming Yang Subject: [PATCH 19/25] net/intel: replace snprintf with strlcpy Date: Thu, 1 Jun 2023 08:01:00 -0700 Message-Id: <20230601150106.18375-20-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601150106.18375-1-stephen@networkplumber.org> References: <20230601150106.18375-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Suggested by devtools/cocci/strlcpy-with-header.cocci Signed-off-by: Stephen Hemminger --- drivers/net/fm10k/fm10k_ethdev.c | 6 +++--- drivers/net/i40e/i40e_rxtx.c | 8 ++++---- drivers/net/iavf/iavf_ethdev.c | 6 +++--- drivers/net/ice/ice_dcf_ethdev.c | 6 +++--- drivers/net/ice/ice_rxtx.c | 8 ++++---- drivers/net/idpf/idpf_ethdev.c | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 4d3c4c10cfa4..cb8cf1a8a8ea 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1244,9 +1244,9 @@ static int fm10k_xstats_get_names(__rte_unused struct rte_eth_dev *dev, /* Global stats */ for (i = 0; i < FM10K_NB_HW_XSTATS; i++) { - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), - "%s", fm10k_hw_stats_strings[count].name); + strlcpy(xstats_names[count].name, + fm10k_hw_stats_strings[count].name, + sizeof(xstats_names[count].name)); count++; } diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 788ffb51c272..54fb9b9c15ec 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -3395,8 +3395,8 @@ i40e_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, for (i = 0; i < RTE_DIM(i40e_rx_burst_infos); ++i) { if (pkt_burst == i40e_rx_burst_infos[i].pkt_burst) { - snprintf(mode->info, sizeof(mode->info), "%s", - i40e_rx_burst_infos[i].info); + strlcpy(mode->info, i40e_rx_burst_infos[i].info, + sizeof(mode->info)); ret = 0; break; } @@ -3526,8 +3526,8 @@ i40e_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, for (i = 0; i < RTE_DIM(i40e_tx_burst_infos); ++i) { if (pkt_burst == i40e_tx_burst_infos[i].pkt_burst) { - snprintf(mode->info, sizeof(mode->info), "%s", - i40e_tx_burst_infos[i].info); + strlcpy(mode->info, i40e_tx_burst_infos[i].info, + sizeof(mode->info)); ret = 0; break; } diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f6d68403ce71..f3474f6faccb 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1802,9 +1802,9 @@ static int iavf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, if (xstats_names != NULL) for (i = 0; i < IAVF_NB_XSTATS; i++) { - snprintf(xstats_names[i].name, - sizeof(xstats_names[i].name), - "%s", rte_iavf_stats_strings[i].name); + strlcpy(xstats_names[i].name, + rte_iavf_stats_strings[i].name, + sizeof(xstats_names[i].name)); } return IAVF_NB_XSTATS; } diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index dcbf2af5b039..ea5296b54246 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1549,9 +1549,9 @@ static int ice_dcf_xstats_get_names(__rte_unused struct rte_eth_dev *dev, if (xstats_names != NULL) for (i = 0; i < ICE_DCF_NB_XSTATS; i++) { - snprintf(xstats_names[i].name, - sizeof(xstats_names[i].name), - "%s", rte_ice_dcf_stats_strings[i].name); + strlcpy(xstats_names[i].name, + rte_ice_dcf_stats_strings[i].name, + sizeof(xstats_names[i].name)); } return ICE_DCF_NB_XSTATS; } diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0ea0045836cc..bde52f7532fb 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -3605,8 +3605,8 @@ ice_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, for (i = 0; i < RTE_DIM(ice_rx_burst_infos); ++i) { if (pkt_burst == ice_rx_burst_infos[i].pkt_burst) { - snprintf(mode->info, sizeof(mode->info), "%s", - ice_rx_burst_infos[i].info); + strlcpy(mode->info, ice_rx_burst_infos[i].info, + sizeof(mode->info)); ret = 0; break; } @@ -3846,8 +3846,8 @@ ice_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, for (i = 0; i < RTE_DIM(ice_tx_burst_infos); ++i) { if (pkt_burst == ice_tx_burst_infos[i].pkt_burst) { - snprintf(mode->info, sizeof(mode->info), "%s", - ice_tx_burst_infos[i].info); + strlcpy(mode->info, ice_tx_burst_infos[i].info, + sizeof(mode->info)); ret = 0; break; } diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index e02ec2ec5ace..39c9edbb3c19 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -384,9 +384,9 @@ static int idpf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, if (xstats_names) for (i = 0; i < IDPF_NB_XSTATS; i++) { - snprintf(xstats_names[i].name, - sizeof(xstats_names[i].name), - "%s", rte_idpf_stats_strings[i].name); + strlcpy(xstats_names[i].name, + rte_idpf_stats_strings[i].name, + sizeof(xstats_names[i].name)); } return IDPF_NB_XSTATS; } -- 2.39.2