* [dpdk-dev] [PATCH] app/crypto-perf: fix dereference of null return
@ 2021-04-23 7:41 Min Hu (Connor)
2021-04-29 11:24 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-05-06 6:13 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
0 siblings, 2 replies; 5+ messages in thread
From: Min Hu (Connor) @ 2021-04-23 7:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, declan.doherty, ciara.power, thomas
Return value of a function 'rte_zmalloc' is dereferenced without
checking, and it may call segmentation fault.
This patch fixed it.
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
app/test-crypto-perf/cperf_options_parsing.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 40b6dfb..5b2f7c3 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -506,6 +506,12 @@ parse_test_name(struct cperf_options *opts,
{
char *test_name = (char *) rte_zmalloc(NULL,
sizeof(char) * (strlen(arg) + 3), 0);
+ if (test_name == NULL) {
+ RTE_LOG(ERR, USER1, "Failed to rte zmalloc with size: %lu\n",
+ strlen(arg) + 3);
+ return -1;
+ }
+
snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
opts->test_name = test_name;
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference of null return
2021-04-23 7:41 [dpdk-dev] [PATCH] app/crypto-perf: fix dereference of null return Min Hu (Connor)
@ 2021-04-29 11:24 ` Min Hu (Connor)
2021-05-05 15:06 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-05-06 6:13 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
1 sibling, 1 reply; 5+ messages in thread
From: Min Hu (Connor) @ 2021-04-29 11:24 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, declan.doherty, ciara.power
Return value of a function 'rte_zmalloc' is dereferenced without
checking, and it may call segmentation fault.
This patch fixed it.
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
v2:
* fix compiling warning.
---
app/test-crypto-perf/cperf_options_parsing.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 40b6dfb..0dd0aa4 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -506,6 +506,12 @@ parse_test_name(struct cperf_options *opts,
{
char *test_name = (char *) rte_zmalloc(NULL,
sizeof(char) * (strlen(arg) + 3), 0);
+ if (test_name == NULL) {
+ RTE_LOG(ERR, USER1, "Failed to rte zmalloc with size: %u\n",
+ strlen(arg) + 3);
+ return -1;
+ }
+
snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
opts->test_name = test_name;
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v2] app/crypto-perf: fix dereference of null return
2021-04-29 11:24 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
@ 2021-05-05 15:06 ` Akhil Goyal
0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2021-05-05 15:06 UTC (permalink / raw)
To: Min Hu (Connor), dev; +Cc: ferruh.yigit, thomas, declan.doherty, ciara.power
> Return value of a function 'rte_zmalloc' is dereferenced without
> checking, and it may call segmentation fault.
>
> This patch fixed it.
>
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> Cc: stable@dpdk.org
>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
> v2:
> * fix compiling warning.
Please fix the compilation reported by CI
In file included from ../lib/eal/include/rte_bus.h:24:0,
from ../lib/eal/include/rte_eal.h:21,
from ../lib/eal/include/rte_lcore.h:16,
from ../lib/eal/include/generic/rte_spinlock.h:21,
from ../lib/eal/x86/include/rte_spinlock.h:12,
from ../lib/mempool/rte_mempool.h:44,
from ../lib/mbuf/rte_mbuf.h:38,
from ../lib/cryptodev/rte_crypto.h:20,
from ../lib/cryptodev/rte_cryptodev.h:22,
from ../app/test-crypto-perf/cperf_options_parsing.c:8:
../app/test-crypto-perf/cperf_options_parsing.c: In function ‘parse_test_name’:
../app/test-crypto-perf/cperf_options_parsing.c:511:19: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Werror=format=]
strlen(arg) + 3);
~~~~~~~~~~~~~~~^
../lib/eal/include/rte_log.h:348:25: note: in definition of macro ‘RTE_LOG’
RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v3] app/crypto-perf: fix dereference of null return
2021-04-23 7:41 [dpdk-dev] [PATCH] app/crypto-perf: fix dereference of null return Min Hu (Connor)
2021-04-29 11:24 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
@ 2021-05-06 6:13 ` Min Hu (Connor)
2021-05-12 16:13 ` [dpdk-dev] [EXT] " Akhil Goyal
1 sibling, 1 reply; 5+ messages in thread
From: Min Hu (Connor) @ 2021-05-06 6:13 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, gakhil
Return value of a function 'rte_zmalloc' is dereferenced without
checking, and it may call segmentation fault.
This patch fixed it.
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
v3:
* fix compiling warning.
---
app/test-crypto-perf/cperf_options_parsing.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 40b6dfb..e84f56c 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -506,6 +506,12 @@ parse_test_name(struct cperf_options *opts,
{
char *test_name = (char *) rte_zmalloc(NULL,
sizeof(char) * (strlen(arg) + 3), 0);
+ if (test_name == NULL) {
+ RTE_LOG(ERR, USER1, "Failed to rte zmalloc with size: %zu\n",
+ strlen(arg) + 3);
+ return -1;
+ }
+
snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
opts->test_name = test_name;
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH v3] app/crypto-perf: fix dereference of null return
2021-05-06 6:13 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
@ 2021-05-12 16:13 ` Akhil Goyal
0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2021-05-12 16:13 UTC (permalink / raw)
To: Min Hu (Connor), dev; +Cc: ferruh.yigit, thomas
> Return value of a function 'rte_zmalloc' is dereferenced without
> checking, and it may call segmentation fault.
>
> This patch fixed it.
>
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> Cc: stable@dpdk.org
>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
> v3:
> * fix compiling warning.
Applied to dpdk-next-crypto
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-12 16:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 7:41 [dpdk-dev] [PATCH] app/crypto-perf: fix dereference of null return Min Hu (Connor)
2021-04-29 11:24 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-05-05 15:06 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-05-06 6:13 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
2021-05-12 16:13 ` [dpdk-dev] [EXT] " Akhil Goyal
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).