patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@nvidia.com>
To: Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	xuemingl@nvidia.com, Asaf Penso <asafp@nvidia.com>,
	gaetan.rivet@6wind.com, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v1 1/7] devargs: fix data buffer storage type
Date: Fri,  8 Jan 2021 22:54:35 +0800
Message-ID: <20210108145441.23320-2-xuemingl@nvidia.com> (raw)
In-Reply-To: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com>

The data field fo struct devargs is used as data scratch buffer, not a
const, remove.

Also fixes references to data field of struct devargs.

Fixes: 338327d731e6 ("devargs: add function to parse device layers")
Fixes: c99a2d4c6b7f ("eal: implement device iteration initialization")
Cc: gaetan.rivet@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 examples/vdpa/main.c                   | 6 ++++--
 lib/librte_eal/common/eal_common_dev.c | 3 +--
 lib/librte_eal/include/rte_dev.h       | 2 +-
 lib/librte_eal/include/rte_devargs.h   | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 97e967b9a2..88e9d8780a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -294,9 +294,10 @@ static void cmd_list_vdpa_devices_parsed(
 	struct rte_vdpa_device *vdev;
 	struct rte_device *dev;
 	struct rte_dev_iterator dev_iter;
+	char args[16];
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
-	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
+	RTE_DEV_FOREACH(dev, strcpy(args, "class=vdpa"), &dev_iter) {
 		vdev = rte_vdpa_find_device_by_name(dev->name);
 		if (!vdev)
 			continue;
@@ -528,6 +529,7 @@ main(int argc, char *argv[])
 	struct rte_vdpa_device *vdev;
 	struct rte_device *dev;
 	struct rte_dev_iterator dev_iter;
+	char args[16];
 
 	ret = rte_eal_init(argc, argv);
 	if (ret < 0)
@@ -549,7 +551,7 @@ main(int argc, char *argv[])
 		cmdline_interact(cl);
 		cmdline_stdin_exit(cl);
 	} else {
-		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
+		RTE_DEV_FOREACH(dev, strcpy(args, "class=vdpa"), &dev_iter) {
 			vdev = rte_vdpa_find_device_by_name(dev->name);
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 8a3bd3100a..793fbdf24b 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -572,8 +572,7 @@ rte_dev_event_callback_process(const char *device_name,
 }
 
 int
-rte_dev_iterator_init(struct rte_dev_iterator *it,
-		      const char *dev_str)
+rte_dev_iterator_init(struct rte_dev_iterator *it, char *dev_str)
 {
 	struct rte_devargs devargs;
 	struct rte_class *cls = NULL;
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index 6dd72c11a1..b320e98637 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -299,7 +299,7 @@ typedef void *(*rte_dev_iterate_t)(const void *start,
  */
 __rte_experimental
 int
-rte_dev_iterator_init(struct rte_dev_iterator *it, const char *str);
+rte_dev_iterator_init(struct rte_dev_iterator *it, char *str);
 
 /**
  * Iterates on a device iterator.
diff --git a/lib/librte_eal/include/rte_devargs.h b/lib/librte_eal/include/rte_devargs.h
index 296f19324f..8a5ffa2af2 100644
--- a/lib/librte_eal/include/rte_devargs.h
+++ b/lib/librte_eal/include/rte_devargs.h
@@ -69,7 +69,7 @@ struct rte_devargs {
 	struct rte_class *cls; /**< class handle. */
 	const char *bus_str; /**< bus-related part of device string. */
 	const char *cls_str; /**< class-related part of device string. */
-	const char *data; /**< Device string storage. */
+	char *data; /**< Device string storage. */
 };
 
 /**
-- 
2.25.1


  reply	other threads:[~2021-01-08 14:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1608304614-13908-1-git-send-email-xuemingl@nvidia.com>
2020-12-18 15:16 ` [dpdk-stable] [RFC 1/9] " Xueming Li
2021-01-08 14:54   ` Xueming Li [this message]
2021-01-08 14:54   ` [dpdk-stable] [PATCH v1 2/7] devargs: fix memory leak on parsing error Xueming Li
2021-01-08 14:54   ` [dpdk-stable] [PATCH v1 3/7] devargs: fix memory leak in legacy parser Xueming Li
2021-01-08 14:54   ` [dpdk-stable] [PATCH v1 4/7] devargs: fix buffer data memory leak Xueming Li
2021-01-18 15:16   ` [dpdk-stable] [PATCH v2 1/5] devargs: fix memory leak on parsing error Xueming Li
2021-03-18  9:12     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2021-03-30 12:15   ` [dpdk-stable] [PATCH v3 2/5] " Xueming Li
2021-04-10 14:23   ` [dpdk-stable] [PATCH v4 " Xueming Li
2021-04-13  3:14   ` [dpdk-stable] [PATCH v5 " Xueming Li
2020-12-18 15:16 ` [dpdk-stable] [RFC 2/9] " Xueming Li
2020-12-18 15:16 ` [dpdk-stable] [RFC 3/9] devargs: fix memory leak in legacy parser Xueming Li
2020-12-18 15:16 ` [dpdk-stable] [RFC 4/9] devargs: fix buffer data memory leak Xueming Li

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=20210108145441.23320-2-xuemingl@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=gaetan.rivet@6wind.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git