[v2,13/16] app/test-dma-perf: verify strdup return value
Checks
Commit Message
Add verify strdup return value logic.
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/test-dma-perf/main.c | 2 ++
1 file changed, 2 insertions(+)
Comments
Acked-by: Huisong Li <lihuisong@huawei.com>
在 2023/11/10 18:01, Chengwen Feng 写道:
> Add verify strdup return value logic.
>
> Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
> app/test-dma-perf/main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
> index e5bccc27da..339ee25eb5 100644
> --- a/app/test-dma-perf/main.c
> +++ b/app/test-dma-perf/main.c
> @@ -206,6 +206,8 @@ parse_lcore_dma(struct test_configure *test_case, const char *value)
> return -1;
>
> input = strndup(value, strlen(value) + 1);
> + if (input == NULL)
> + return -1;
> addrs = input;
>
> while (*addrs == '\0')
@@ -206,6 +206,8 @@ parse_lcore_dma(struct test_configure *test_case, const char *value)
return -1;
input = strndup(value, strlen(value) + 1);
+ if (input == NULL)
+ return -1;
addrs = input;
while (*addrs == '\0')