From: Stephen Hemminger Date: Mon, 27 Apr 2020 23:16:24 +0000 (-0700) Subject: stack: check flags on creation for future proofing X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=28396b9043f98804a9bd7f7c7a29bc399ea9865f;p=dpdk.git stack: check flags on creation for future proofing All API's should check that they support the flag values passed. If an application passes an invalid flag it could cause problems in later ABI. Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Konstantin Ananyev Acked-by: Gage Eads --- diff --git a/lib/librte_stack/rte_stack.c b/lib/librte_stack/rte_stack.c index d19824f004..e58fa545fc 100644 --- a/lib/librte_stack/rte_stack.c +++ b/lib/librte_stack/rte_stack.c @@ -59,6 +59,11 @@ rte_stack_create(const char *name, unsigned int count, int socket_id, unsigned int sz; int ret; + if (flags & ~(RTE_STACK_F_LF)) { + STACK_LOG_ERR("Unsupported stack flags %#x\n", flags); + return NULL; + } + #ifdef RTE_ARCH_64 RTE_BUILD_BUG_ON(sizeof(struct rte_stack_lf_head) != 16); #else