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 CDB0142C04; Thu, 1 Jun 2023 17:03:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9275342DB3; Thu, 1 Jun 2023 17:01:33 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 96B7442D93 for ; Thu, 1 Jun 2023 17:01:30 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1b02085bf8dso4389695ad.0 for ; Thu, 01 Jun 2023 08:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685631689; x=1688223689; 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=aKTYFTgDMobt85QN4hlYLhT1Yx+YASoq64PqApvDBiA=; b=tSzF9F52qfiFPzX73AU1s18GfioJE+wDhPoVBB9OtYu/jbUjPA13jv/cX6pS8rUtqF 2425TZdp/Q+u6/ovtjeMJ7o/vnZ42wUVDhduUAU49WFzdjiLbId6jkvqB8CwME3k4B0i ri7gzrERshPaqvzX8nFKUryQg9GTn+svR8anS2S1+xYJXq9DKn9N+KnFTfa6xle2o160 pFFnFay1VpyBi0zOf4JClSbIv8YLLfPAK1tCnMd+Fns/KYDDdpddWF2fOB6YlGmO9Z4w R0YQSFT04ZTuWVPD8ikEucetmzIdjWNlLSm96RCOnKVWFo1ACe5j7Jz1KwuU/wSh1vQ4 HCBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685631689; x=1688223689; 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=aKTYFTgDMobt85QN4hlYLhT1Yx+YASoq64PqApvDBiA=; b=QM8qvWlvp2ujZMkGQ+xtkfD6/YNor0nkBnix6DIaTA4VO2n0HDMmm1ra3ezLzzkyID gYgG+SlxB7mtJAVrdq3gzjWg3k4frT+1MuWAyJJql7uMbdo21P/vOqEWRAFntjPYWl4v 5DAHYazKQnFJAaeTp8rf/2uGBOtYUZ9JwXVyPjHtBsfdpU9Q2yc9YtuLx09TYYpw/zhb /Ll0mgAv8FA8XiPUlCBvwEavcJQ17/kwse9O/+c+jlFc9bIOg4wCDUyU/htW+Hg1uKQH 99iamCqt9ULKamCWqC8aQAtWG3vLXJjOIn3+AVjDvnbJSJbpw6WXF0Ty1ffWpO55FkYZ OzHg== X-Gm-Message-State: AC+VfDy+Ixfh3h1PeKiAN3gMQM12gQo8IgixWcBtux3ab0UhCvUAtMYP K9VNNhl4u7Co/5vYN6eTnGfyyTJKeiUHIUIjx4Ww0g== X-Google-Smtp-Source: ACHHUZ7ZFkpyc8ihJwAxkpOGxy4xZ6AkikPz501bVmTytQVLuW1i9KhgozVqclkQHLkRVVwPz3M4VQ== X-Received: by 2002:a17:902:e789:b0:1af:bcf7:2bd8 with SMTP id cp9-20020a170902e78900b001afbcf72bd8mr4723241plb.52.1685631689568; Thu, 01 Jun 2023 08:01:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 08:01:29 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Rahul Lakkireddy Subject: [PATCH 15/25] net/cxgbe: replace snprintf with strlcpy Date: Thu, 1 Jun 2023 08:00:56 -0700 Message-Id: <20230601150106.18375-16-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/cxgbe/cxgbe_ethdev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 45bbeaef0ceb..a00fa6051344 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -928,9 +928,8 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev, count = 0; for (i = 0; i < nstats; i++, count++) { if (xstats_names != NULL) - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), - "%s", xstats_str[i].name); + strlcpy(xstats_names[count].name, xstats_str[i].name, + sizeof(xstats_names[count].name)); if (xstats != NULL) { stats_ptr = RTE_PTR_ADD(&ps, xstats_str[i].offset); @@ -1043,8 +1042,8 @@ int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, ret = -EINVAL; goto out_err; } - rte_strlcpy(xnames[i].name, xnames_copy[ids[i]].name, - sizeof(xnames[i].name)); + strlcpy(xnames[i].name, xnames_copy[ids[i]].name, + sizeof(xnames[i].name)); } ret = n; -- 2.39.2