Skip to content

Commit

Permalink
dma/idxd: verify strdup return
Browse files Browse the repository at this point in the history
[ upstream commit 83cfa2cbf3f3fb78e2f2dd228109adcb38e18a5c ]

Add verify strdup return value logic.

Fixes: e888bb1 ("dma/idxd: add bus device probing")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
  • Loading branch information
fengchengwen authored and kevintraynor committed Mar 5, 2024
1 parent fa4c241 commit 93cc8c4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/dma/idxd/idxd_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,15 @@ static int
is_for_this_process_use(const char *name)
{
char *runtime_dir = strdup(rte_eal_get_runtime_dir());
char *prefix = basename(runtime_dir);
int prefixlen = strlen(prefix);
int retval = 0;
int prefixlen;
char *prefix;

if (runtime_dir == NULL)
return retval;

prefix = basename(runtime_dir);
prefixlen = strlen(prefix);

if (strncmp(name, "dpdk_", 5) == 0)
retval = 1;
Expand Down

0 comments on commit 93cc8c4

Please sign in to comment.