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 AC127A00BE; Tue, 28 Apr 2020 01:17:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F020B1D54E; Tue, 28 Apr 2020 01:16:44 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id EF06F1D534 for ; Tue, 28 Apr 2020 01:16:40 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id w65so9732749pfc.12 for ; Mon, 27 Apr 2020 16:16:40 -0700 (PDT) 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=5g1dTUi5guNJR46ba7VAynNH00ugrf1kkX2Uc4mf1aA=; b=zbwgNShoeak94K9cNHWFPrxthvFxge/xJAO1Kk1iOtUbRbj7KcXYRrMhLHTDUO2pox zZ6Woevthh+a97hD47F5a47Snv42dq3NWkjauFtkv4AXZ+foQVxiITo5MXAifGg4SxWl XkrKdDXGJwh9yGZj/yGFjbXFrsd7hoZLG7x22uMghdKifUrSe8pmjKJVIpO3j0Sj4X1z u9pEqIjn0bPsACO6lPSNuamfM21NeR8HChN+EidcYPy3nRZRtrcNSnb2GT1RI8batWdr B/UTEnhyokBD+Vspwg/MGg+zL9yVq5hls6vGqUfACmokONcZbVvECx5tX0gbp2z6UqNf P3MQ== 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=5g1dTUi5guNJR46ba7VAynNH00ugrf1kkX2Uc4mf1aA=; b=j790LLiih5gPEMmoJqPL/ud2l0fmqiiNrbCJYD9M705AWd0Cc8y5+qadzinry+7QcP hnugUNR8tV3b+mrd91HanE0CGWitId8BVILK+OmTGNEnLvFTFVRKdgAO+wUQ8r/r8Mmh cKZVy86bTm0c8gjZTHkSKR33BIXb1A+CARVTy/yV1Do+Gzn443vt1jOwErqyQ11xvVPW 5WnzfzR5tmadbfqZedJ/BHjxxdZ3c5LV4yU0TyBkveyi2qIBhsZachMZ3Re/L4AqtFwj lvLP3nEU7gWqZ0BVcffBTqkaalzvCFS+RJXuoCTimuqsY3Pf9x57uHOm5G8UTingTmR4 lvow== X-Gm-Message-State: AGi0PubVpyDPDVo/U2BCwLfZ1c9hfQgtP6Kv5nHUtnZkL1vH1aP0kPWs hVmZqp4yazxyP29jOSsWZJawH0GNUMA= X-Google-Smtp-Source: APiQypJCh3AkJTa5qp5VTnZYlYvLC7NY4psoI0pJGoD3x2/FZcmga5mY3djRmdivFi68W7Goyvq8rA== X-Received: by 2002:a63:f90c:: with SMTP id h12mr25314630pgi.124.1588029399709; Mon, 27 Apr 2020 16:16:39 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id kb10sm353104pjb.6.2020.04.27.16.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 16:16:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Date: Mon, 27 Apr 2020 16:16:25 -0700 Message-Id: <20200427231625.10135-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200427231625.10135-1-stephen@networkplumber.org> References: <20200212230810.2837-1-stephen@networkplumber.org> <20200427231625.10135-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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..714717dd9007 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