mbuf: prevent setting mempool ops name empty
Bugzilla ID: 353 Signed-off-by: Muhammad Bilal <m.bilal@emumba.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
parent
e6cf7bee1c
commit
ec5a905ec8
@ -14,7 +14,10 @@ rte_mbuf_set_platform_mempool_ops(const char *ops_name)
|
|||||||
{
|
{
|
||||||
const struct rte_memzone *mz;
|
const struct rte_memzone *mz;
|
||||||
|
|
||||||
if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
|
size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
|
||||||
|
if (len == 0)
|
||||||
|
return -EINVAL;
|
||||||
|
if (len == RTE_MEMPOOL_OPS_NAMESIZE)
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
mz = rte_memzone_lookup("mbuf_platform_pool_ops");
|
mz = rte_memzone_lookup("mbuf_platform_pool_ops");
|
||||||
@ -51,7 +54,10 @@ rte_mbuf_set_user_mempool_ops(const char *ops_name)
|
|||||||
{
|
{
|
||||||
const struct rte_memzone *mz;
|
const struct rte_memzone *mz;
|
||||||
|
|
||||||
if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
|
size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
|
||||||
|
if (len == 0)
|
||||||
|
return -EINVAL;
|
||||||
|
if (len == RTE_MEMPOOL_OPS_NAMESIZE)
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
mz = rte_memzone_lookup("mbuf_user_pool_ops");
|
mz = rte_memzone_lookup("mbuf_user_pool_ops");
|
||||||
|
Loading…
Reference in New Issue
Block a user