cfgfile: 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 <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
Stephen Hemminger 2020-04-27 16:16:25 -07:00 committed by Thomas Monjalon
parent 28396b9043
commit f3687f251e

View File

@ -272,6 +272,10 @@ rte_cfgfile_create(int flags)
int i;
struct rte_cfgfile *cfg;
/* future proof flags usage */
if (flags & ~(CFG_FLAG_GLOBAL_SECTION | CFG_FLAG_EMPTY_VALUES))
return NULL;
cfg = malloc(sizeof(*cfg));
if (cfg == NULL)