env: Explicitly fail calls to spdk_malloc with flags of 0
Passing no flags to spdk_malloc is not a valid usage. Instead, just call POSIX malloc. Change-Id: I759e2c0c0befeb4983df953edd1529d6359b4c55 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/410479 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
8b75f85f2d
commit
b1ccb095e4
@ -94,6 +94,7 @@ struct spdk_env_opts {
|
||||
* \param socket_id Socket ID to allocate memory on, or SPDK_ENV_SOCKET_ID_ANY
|
||||
* for any socket.
|
||||
* \param flags Combination of SPDK_MALLOC flags (\ref SPDK_MALLOC_DMA, \ref SPDK_MALLOC_SHARE).
|
||||
* At least one flag must be specified.
|
||||
*
|
||||
* \return a pointer to the allocated memory buffer.
|
||||
*/
|
||||
|
@ -65,6 +65,10 @@ virt_to_phys(void *vaddr)
|
||||
void *
|
||||
spdk_malloc(size_t size, size_t align, uint64_t *phys_addr, int socket_id, uint32_t flags)
|
||||
{
|
||||
if (flags == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *buf = rte_malloc_socket(NULL, size, align, socket_id);
|
||||
if (buf && phys_addr) {
|
||||
*phys_addr = virt_to_phys(buf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user