From: Harman Kalra <hkalra@marvell.com>
To: "shreyansh.jain@nxp.com" <shreyansh.jain@nxp.com>,
"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
"marko.kallio@cavium.com" <marko.kallio@cavium.com>,
Harman Kalra <hkalra@marvell.com>,
Kallio Marko <marko.kallio@cavium.comm>
Subject: [dpdk-dev] [PATCH] raw/skeleton: fix segmentation fault on rawdev_autotest
Date: Tue, 11 Dec 2018 13:14:30 +0000 [thread overview]
Message-ID: <20181211131412.14232-1-hkalra@marvell.com> (raw)
segmentation fault ocured as vdev->device.driver->name did not
return correct value.
Test2 failed as dummy_value was freed before it was used.
Signed-off-by: Kallio Marko <marko.kallio@cavium.comm>
Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 3 ++-
drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
index d7630fc69..c957ced11 100644
--- a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
+++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
@@ -585,7 +585,8 @@ skeleton_rawdev_create(const char *name,
rawdev->dev_ops = &skeleton_rawdev_ops;
rawdev->device = &vdev->device;
- rawdev->driver_name = vdev->device.driver->name;
+
+ rawdev->driver_name = rawdev->name;
skeldev = skeleton_rawdev_get_priv(rawdev);
diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
index 359c9e296..788c3f1b9 100644
--- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
@@ -294,14 +294,14 @@ test_rawdev_attr_set_get(void)
"Attribute (Test1) not set correctly (%" PRIu64 ")",
ret_value);
- free(dummy_value);
-
ret_value = 0;
ret = rte_rawdev_get_attr(TEST_DEV_ID, "Test2", &ret_value);
RTE_TEST_ASSERT_EQUAL(*((int *)(uintptr_t)ret_value), 200,
"Attribute (Test2) not set correctly (%" PRIu64 ")",
ret_value);
+ free(dummy_value);
+
return TEST_SUCCESS;
}
--
2.18.0
next reply other threads:[~2018-12-11 13:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 13:14 Harman Kalra [this message]
2018-12-13 7:22 ` Shreyansh Jain
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=20181211131412.14232-1-hkalra@marvell.com \
--to=hkalra@marvell.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jerinj@marvell.com \
--cc=marko.kallio@cavium.com \
--cc=marko.kallio@cavium.comm \
--cc=shreyansh.jain@nxp.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).