DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
To: <akhil.goyal@nxp.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>, <jsrikanth@marvell.com>,
	Nagadheeraj Rottela <rnagadheeraj@marvell.com>
Subject: [dpdk-dev] [PATCH v3 2/2] crypto/nitrox: fix array out of bounds access
Date: Fri, 27 Mar 2020 19:12:39 +0530	[thread overview]
Message-ID: <20200327134239.23358-2-rnagadheeraj@marvell.com> (raw)
In-Reply-To: <20200327134239.23358-1-rnagadheeraj@marvell.com>

In nitrox_sym_pmd_create() the name array will overflow if the pci
device name is greater than 57 bytes. To fix this issue subtract pci
device name length from array length while appending substring to the
name.

Coverity issue: 349926

Fixes: 9fdef0cc2385 ("crypto/nitrox: create symmetric cryptodev")

Signed-off-by: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
---
 drivers/crypto/nitrox/nitrox_sym.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index 56410c44d..d1b32fec9 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -683,7 +683,8 @@ nitrox_sym_pmd_create(struct nitrox_device *ndev)
 	struct rte_cryptodev *cdev;
 
 	rte_pci_device_name(&ndev->pdev->addr, name, sizeof(name));
-	snprintf(name + strlen(name), RTE_CRYPTODEV_NAME_MAX_LEN, "_n5sym");
+	snprintf(name + strlen(name), RTE_CRYPTODEV_NAME_MAX_LEN - strlen(name),
+		 "_n5sym");
 	ndev->rte_sym_dev.driver = &nitrox_rte_sym_drv;
 	ndev->rte_sym_dev.numa_node = ndev->pdev->device.numa_node;
 	ndev->rte_sym_dev.devargs = NULL;
-- 
2.13.6


  reply	other threads:[~2020-03-27 13:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 11:04 [dpdk-dev] [PATCH] crypto/nitrox: fix coverity defects Nagadheeraj Rottela
2020-02-20 11:07 ` Akhil Goyal
2020-02-20 11:51   ` Thomas Monjalon
2020-02-25  9:46 ` [dpdk-dev] [PATCH v2 1/2] crypto/nitrox: fix invalid CSR register address generation Nagadheeraj Rottela
2020-02-25  9:46   ` [dpdk-dev] [PATCH v2 2/2] crypto/nitrox: fix array out of bounds access Nagadheeraj Rottela
2020-03-25  9:10   ` [dpdk-dev] [PATCH v2 1/2] crypto/nitrox: fix invalid CSR register address generation Akhil Goyal
2020-03-27 13:42     ` [dpdk-dev] [PATCH v3 " Nagadheeraj Rottela
2020-03-27 13:42       ` Nagadheeraj Rottela [this message]
2020-04-05 16:55         ` [dpdk-dev] [PATCH v3 2/2] crypto/nitrox: fix array out of bounds access Akhil Goyal
2020-04-05 16:54       ` [dpdk-dev] [PATCH v3 1/2] crypto/nitrox: fix invalid CSR register address generation Akhil Goyal

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=20200327134239.23358-2-rnagadheeraj@marvell.com \
    --to=rnagadheeraj@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=jsrikanth@marvell.com \
    --cc=thomas@monjalon.net \
    /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).