env: Check return value of rte_mempool_get in spdk_mempool_get
According to the rte_mempool.h, the retrieved pointer will be valid when rte_mempool_get() returns 0. Change-Id: Iac8a62f9dd39cd7b70478009503f17d78375a124 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/391161 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
d1bb67a34d
commit
e9dff43982
@ -189,9 +189,12 @@ void *
|
||||
spdk_mempool_get(struct spdk_mempool *mp)
|
||||
{
|
||||
void *ele = NULL;
|
||||
int rc;
|
||||
|
||||
rte_mempool_get((struct rte_mempool *)mp, &ele);
|
||||
|
||||
rc = rte_mempool_get((struct rte_mempool *)mp, &ele);
|
||||
if (rc != 0) {
|
||||
return NULL;
|
||||
}
|
||||
return ele;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user