From: Fiona Trahe <fiona.trahe@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com,
tomaszx.jozwiak@intel.com
Subject: [dpdk-dev] [PATCH] common/qat: replace snprintf
Date: Mon, 2 Jul 2018 18:25:34 +0100 [thread overview]
Message-ID: <1530552334-22169-1-git-send-email-fiona.trahe@intel.com> (raw)
Replaced snprintf with strlcpy for safer string copy
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
---
drivers/common/qat/qat_device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index 64f236e..f32d723 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -2,6 +2,8 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <rte_string_fns.h>
+
#include "qat_device.h"
#include "adf_transport_access_macros.h"
#include "qat_sym_pmd.h"
@@ -116,7 +118,7 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev)
qat_dev = qat_pci_get_dev(qat_dev_id);
memset(qat_dev, 0, sizeof(*qat_dev));
- snprintf(qat_dev->name, QAT_DEV_NAME_MAX_LEN, "%s", name);
+ strlcpy(qat_dev->name, name, QAT_DEV_NAME_MAX_LEN);
qat_dev->qat_dev_id = qat_dev_id;
qat_dev->pci_dev = pci_dev;
switch (qat_dev->pci_dev->id.device_id) {
--
2.7.4
next reply other threads:[~2018-07-02 17:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 17:25 Fiona Trahe [this message]
2018-07-05 10:47 ` De Lara Guarch, Pablo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1530552334-22169-1-git-send-email-fiona.trahe@intel.com \
--to=fiona.trahe@intel.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@intel.com \
--cc=tomaszx.jozwiak@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).