From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45DBCA0542; Thu, 13 Feb 2020 00:09:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D7021BFAD; Thu, 13 Feb 2020 00:08:31 +0100 (CET) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by dpdk.org (Postfix) with ESMTP id 8FA961BF76 for ; Thu, 13 Feb 2020 00:08:26 +0100 (CET) Received: by mail-pj1-f66.google.com with SMTP id j17so1531684pjz.3 for ; Wed, 12 Feb 2020 15:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SPNYYAZx0glh7yrtX1B0LIV4voFt/De2gvQJUOke2a4=; b=JvKXHcTW23IV5yPuIJwhHFFFNAanLwvEStI61jVlCWGp5ddVyBnnSHR97Vbo3F3mBW DtqKfIXP/rD0wwiRjFqRcFPOAf1pe4q5jOUO9vlNqpfIoT99Snn8RAEACYkUPZAxXNwE jMxibwlE+nBbus4ga4gaqsFPGamhh8Fr6ZSJc0LMYxIMfwiXvlzoNPA4cgESs2QuvX8F KQyFcSgiA0EW3QPKzQ3auElOZ6pZvdHqlZEXPDgPmU6cPXzxcIqTpwulCBHkKACLySSn Puat93N1tFApj+4a5uV3JHCYQsCwnkIi1+eUwEGVVKR1/ffOXadQ1BlEPLNXyF5TS4q2 fv4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SPNYYAZx0glh7yrtX1B0LIV4voFt/De2gvQJUOke2a4=; b=RUdXvXCIQ0C5aPaVcIwM7KNiKEiPRM6q+SLk8c4byah6BfD4gzRSoC7YNOf2pFk1Jd htHJTU0toNvdJ3HbNYLrnB7eOSYdDm22Drx1Am+9q8P3XTQr+Hmdwp/zZ1TDATln6JD4 Omtkwx+SgO+V/aImgTijtYUzmDuyn0Jhq6dlV9e09o2mky9pI3LjQTTAJMui4MyHEbiV t1womVEjVwZi175CzFXrNGIO3INaTVoNymO3pIaxL0AKiglTznXZkO51xcKaMlrR1E3e QUJQWmooBvmOe1p4S3WVYbYxMAi52Pu9WcBad9v7RvGDjp5VHzEPbKaPzt5JBuD8MwnI jhEQ== X-Gm-Message-State: APjAAAUTmOja3raQBmOASeMYOULII08xuetZt8pbQwGnBTKICgIY6X7x fQ9ycNMjiS9LzmU0IVO76QbvIqpmNq4= X-Google-Smtp-Source: APXvYqxwkn7PHA8/cp7BaOqTdxek5S4lDKfUp4eYxxfwK6BuAv0ycyfZ/L//h3q2HHEqwe8JZF3niA== X-Received: by 2002:a17:90b:3c9:: with SMTP id go9mr1612174pjb.7.1581548905293; Wed, 12 Feb 2020 15:08:25 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id f18sm198301pgn.2.2020.02.12.15.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 15:08:24 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 12 Feb 2020 15:08:10 -0800 Message-Id: <20200212230810.2837-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200212230810.2837-1-stephen@networkplumber.org> References: <20200212230810.2837-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 4/4] cfgfile: check flags value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- lib/librte_cfgfile/rte_cfgfile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 9049fd9c2319..cec82c82ee20 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -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) -- 2.20.1