Message ID | 20230601150106.18375-5-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Rejected, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 6701D42C04; Thu, 1 Jun 2023 17:01:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B2BF42D42; Thu, 1 Jun 2023 17:01:19 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 5F10242D3F for <dev@dpdk.org>; Thu, 1 Jun 2023 17:01:18 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-64f47448aeaso647785b3a.0 for <dev@dpdk.org>; Thu, 01 Jun 2023 08:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685631677; x=1688223677; 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=mnNZnferKtAN5dQAZ0nl8YtGIyjuTkqE1jvZ3mmpjeU=; b=pcMb6dww2kNapWFVRI+kJUQnKb3QJllHaiTNDX3I6PGgxbzpJeoKn/CGskTYylpKRF rAbfJhJDnpQjh52c/iZTe/9kIHFH5Zmndx3F48xF+QwcEvpOJwBw80tEK+PZK+Z6e3xm dSd3mjx5EcPMxTqeb7I5rihRKwiA5Z/I9bJ5Sxcxohpl99wI/izIbxGkvEkwvMGx72id fyZEQBkLCZ7wSYFRwpAm85nBthLS7U2sNDBOYMKnUsvAOKRy1y346wGcFzDSX9h+Fj8S yrr+cbSs9BsviZyTzZuUHzPBwvP5pFNO3yf/P8kqhi4E8LzgVoKcQDIv+3ThDEt/3roR E4aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685631677; x=1688223677; 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=mnNZnferKtAN5dQAZ0nl8YtGIyjuTkqE1jvZ3mmpjeU=; b=WT1molC7itSKK7w992oeDV9ngVS786BwRkh8pElcPjkLoWo5obHCTHNkq6/qxv2xAL OBUKfcJbkTEV15SS61afnJ6lRjboxhaj9DwTXw5y796IapK5jXt3fz6oC421yAh7U6L9 MBW2p8eZwMmzrSKOwGErWfR6gRRIl3vzr2WaRXdHKDchBKW6EaPBtdG7KBSDZJDtGZJW EYYRaPzllxyjzqLDaHw/j8QfYS9tRquE6XCrRzRYP/SRIwbl6kNq/hB0IrNpy6q/DCIt ccOb2V15Ulx6hZ/tzjYLlJAv+Bv9y6f7TlxXT3vhxXh9GmOF7+DqgkVHRX5Xpj1C8ZN2 dEKg== X-Gm-Message-State: AC+VfDwugJpqCCOxRwAqtBVyuz23druvQcpcynDRoiFl0WxdY2er72Y2 IFG1Re1s+DeIwyiAY7CXn96B0tjtoK7m154WBHxyoQ== X-Google-Smtp-Source: ACHHUZ4D86IVo4v/VK1VCuaN5d9Goi0iLltIrmZti2z6I747dmqPeCXL/PisQ1AzAYoaAdSLPXYOog== X-Received: by 2002:a05:6a20:3c87:b0:10f:2abb:c9fd with SMTP id b7-20020a056a203c8700b0010f2abbc9fdmr8142481pzj.43.1685631677223; Thu, 01 Jun 2023 08:01:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 08:01:16 -0700 (PDT) From: Stephen Hemminger <stephen@networkplumber.org> To: dev@dpdk.org Cc: Stephen Hemminger <stephen@networkplumber.org>, Rosen Xu <rosen.xu@intel.com>, Tianfei Zhang <tianfei.zhang@intel.com> Subject: [PATCH 04/25] raw/ifpga: replace snprintf with strlcpy Date: Thu, 1 Jun 2023 08:00:45 -0700 Message-Id: <20230601150106.18375-5-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 <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
replace snprintf with strlcpy
|
|
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
Stephen Hemminger
June 1, 2023, 3 p.m. UTC
Suggested by devtools/cocci/strlcpy-with-header.cocci
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/raw/ifpga/afu_pmd_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi, > -----Original Message----- > From: Stephen Hemminger <stephen@networkplumber.org> > Sent: Thursday, June 1, 2023 11:01 PM > To: dev@dpdk.org > Cc: Stephen Hemminger <stephen@networkplumber.org>; Xu, Rosen > <rosen.xu@intel.com>; Zhang, Tianfei <tianfei.zhang@intel.com> > Subject: [PATCH 04/25] raw/ifpga: replace snprintf with strlcpy > > Suggested by devtools/cocci/strlcpy-with-header.cocci > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > drivers/raw/ifpga/afu_pmd_core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/raw/ifpga/afu_pmd_core.c > b/drivers/raw/ifpga/afu_pmd_core.c > index 3ab1f47ac1a4..e969897dbe7d 100644 > --- a/drivers/raw/ifpga/afu_pmd_core.c > +++ b/drivers/raw/ifpga/afu_pmd_core.c > @@ -16,6 +16,7 @@ > #include <rte_malloc.h> > #include <rte_memzone.h> > #include <rte_rawdev_pmd.h> > +#include <rte_string_fns.h> > > #include "afu_pmd_core.h" > > @@ -225,7 +226,7 @@ static int afu_shared_data_alloc(const char *name, > return -EINVAL; > > /* name format is afu_?|??:??.? which is unique */ > - snprintf(mz_name, sizeof(mz_name), "%s", name); > + strlcpy(mz_name, name, sizeof(mz_name)); > > mz = rte_memzone_lookup(mz_name); > if (!mz) { > -- > 2.39.2 Reviewed-by: Rosen Xu <rosen.xu@intel.com>
diff --git a/drivers/raw/ifpga/afu_pmd_core.c b/drivers/raw/ifpga/afu_pmd_core.c index 3ab1f47ac1a4..e969897dbe7d 100644 --- a/drivers/raw/ifpga/afu_pmd_core.c +++ b/drivers/raw/ifpga/afu_pmd_core.c @@ -16,6 +16,7 @@ #include <rte_malloc.h> #include <rte_memzone.h> #include <rte_rawdev_pmd.h> +#include <rte_string_fns.h> #include "afu_pmd_core.h" @@ -225,7 +226,7 @@ static int afu_shared_data_alloc(const char *name, return -EINVAL; /* name format is afu_?|??:??.? which is unique */ - snprintf(mz_name, sizeof(mz_name), "%s", name); + strlcpy(mz_name, name, sizeof(mz_name)); mz = rte_memzone_lookup(mz_name); if (!mz) {