From patchwork Thu Jun 1 15:00:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 127850 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA53242BF2; Thu, 1 Jun 2023 17:03:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E97942D75; Thu, 1 Jun 2023 17:01:28 +0200 (CEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 8886B42D0D for ; Thu, 1 Jun 2023 17:01:25 +0200 (CEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1b024e29657so4263315ad.3 for ; Thu, 01 Jun 2023 08:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685631685; x=1688223685; 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=+YABHkpto7McdN0ZM1kCvQncty03rMYfMiMT51DCr6w=; b=JsTsB6d4vooGqSPhoT4HWJAL5cmlvXTdzzpFLZZSblVZX0xhhtYa3dywO/k9EJftDm GxxZdS014FAUfn3SXZYDmt4cDoc08ghLsQfsmycLEJcI1bmyNROS76xpOplJYV219zDg Jvuefe4d2eB7HB5O9RArNuw00ft2KRQdQq3RHvt7qMm95XG7LsDo3ETSJB9uJ+wf7red JQvFsxHtbiwfYlkiVLEu3QmiGm8scUhPo0Hpp4e/1OAaIvYW+fTnx1y8ICNCLEHDGYoT 5f/JiicmwnAEhozKaTiiffG5+4or2vSuXj7jtA60vBTAhR6DcK/73c59pRBlzKGu84eg qeTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685631685; x=1688223685; 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=+YABHkpto7McdN0ZM1kCvQncty03rMYfMiMT51DCr6w=; b=R9a5ShBVnGt5717wBinKU0WMP3R8JPXw/7ERGGVg1fHUv3HJht1glLEwkofDa6v/Ap Q8rbyU97EMs2MTYHmXBPrdF0f+yyhOfqEsFXGv4+bDEuCbAD8+hnhkRt34+NNOckT2C5 DWRvt3Brnxb67JcjxZy3HF9Dn/4XcuVwMfpiORQN7jXswoWpCxhTKu2BOu7YNRQMY3MX SAtBx9g1ZPuihstUSi+01psjWvFtf2xE7DaPYl4V6g8UDKk1t6AtUdFKaom3O2PXY3bN IDzcI0TFhzYEkJpfCG8Z3GX0fB7ceStB4GMjtFGjaH9BrgPeulCeP7J5CDgeCFD6dGWn LOuA== X-Gm-Message-State: AC+VfDydXAj1QevYHALKNXtU2QRqIpmT7iQqIp0Q+NLnF1DVPRMnJRMO TEntbr3aAVd8BtuzjLMbFH16LEFSd6fkcZWOkML7OA== X-Google-Smtp-Source: ACHHUZ6QlsoWwSeddoXgDj8ZFP8erdcVsxgcJVbWtBJwUVWqLuKhrit1JniVTlkMrfIXkTHlPUOsgA== X-Received: by 2002:a17:902:f682:b0:1ac:63ac:10a7 with SMTP id l2-20020a170902f68200b001ac63ac10a7mr6804577plg.68.1685631684807; Thu, 01 Jun 2023 08:01:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 08:01:24 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Pavan Nikhilesh , Shijith Thotton Subject: [PATCH 10/25] event/cnxk: replace snprintf with strlcpy Date: Thu, 1 Jun 2023 08:00:51 -0700 Message-Id: <20230601150106.18375-11-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 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/event/cnxk/cnxk_eventdev_stats.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c index a8a87a06e43e..e18d24815f81 100644 --- a/drivers/event/cnxk/cnxk_eventdev_stats.c +++ b/drivers/event/cnxk/cnxk_eventdev_stats.c @@ -246,15 +246,14 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev, unsigned int i; for (i = 0; i < CNXK_SSO_NUM_HWS_XSTATS; i++) { - snprintf(xstats_names_copy[i].name, - sizeof(xstats_names_copy[i].name), "%s", - sso_hws_xstats[i].name); + strlcpy(xstats_names_copy[i].name, sso_hws_xstats[i].name, + sizeof(xstats_names_copy[i].name)); } for (; i < CNXK_SSO_NUM_XSTATS; i++) { - snprintf(xstats_names_copy[i].name, - sizeof(xstats_names_copy[i].name), "%s", - sso_hwgrp_xstats[i - CNXK_SSO_NUM_HWS_XSTATS].name); + strlcpy(xstats_names_copy[i].name, + sso_hwgrp_xstats[i - CNXK_SSO_NUM_HWS_XSTATS].name, + sizeof(xstats_names_copy[i].name)); } switch (mode) {