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 7ACB2A00C2; Fri, 24 Apr 2020 19:16:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3BA971D529; Fri, 24 Apr 2020 19:15:56 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id DF5711D455 for ; Fri, 24 Apr 2020 19:15:50 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id v2so3956742plp.9 for ; Fri, 24 Apr 2020 10:15:50 -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=RjAu4ss9G5+1FLa4JlidW3QPZ1KLdayPW+q97H6dEoDWwbeR4ylO5MxGj+YsxRNcYp +OMufjzw4Qbml/LnbEm4pVh0Gvm7prubV+HzS5lMve42skU7rvpCSgnL/PMgrwBR8hKq 1hJf9KfJivncsFkg4DpCY5/VOVJvJEzm8ncZlwnYUiVis5F3oHAm39uoSPoRKsqu9an4 S+nG2gTRhG6HdauoAytogZDigVCG6TiQabrDPU+6JjAMghguMTUJFKvxJ0ZEB4Q92DQe fpSblcQd1E0L2ulS+Ikm96vQdhHhythyBjcKu3GBPRXQv/TQwhhAFGEyjKq0iRdlfg8B o3Kg== 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=WJsuMgo2Nwkvmk6rkn+Ck73SWyDt386qo+iPhRNZUhHozPJlBYWMtiHnTpNNt9D/kJ TrHQmpVcvlw8fyNgjFims8Guh66efGIYsvrl48OBCP6kyXs/NFIztrEg6SiwIizRUp/B 08pew3udSn0Zba2Fu/XTz1GqgCMsLxK3uIGyucMz2MVKNINKv/oAVI3CSZ/lYy8XvD3b U+AtVVw0DF4lfHfO4EaqDMbkJp2b/5Jz/I0FBGEf2n/Ig1rS5VRtjT0kPGS2ryNBHQIr xKuC5RBhX8SUn18agbJwbU4QiEsYmqLAoQAqUQKO5ye/NKPbHzWSa0smjn8T508H92pm Gf7w== X-Gm-Message-State: AGi0Pub4W52pBwGZdphYHLuq6zXhYX9duEELq4v8y8GbNG5fFGevs+oL RmuaIjx7fw4T6Bt1ZNggOjUu4Uc1s3w= X-Google-Smtp-Source: APiQypJh2ovN33jEO32P0zA/nGeSCeaPnqKNkfSY3VuhNK1rXBDdTXl188bp6ephmEWq5bAXkW2I+Q== X-Received: by 2002:a17:902:b111:: with SMTP id q17mr9983987plr.160.1587748549737; Fri, 24 Apr 2020 10:15:49 -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 w3sm6153245pfn.115.2020.04.24.10.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 10:15:48 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 24 Apr 2020 10:15:36 -0700 Message-Id: <20200424171536.11535-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424171536.11535-1-stephen@networkplumber.org> References: <20200212230810.2837-1-stephen@networkplumber.org> <20200424171536.11535-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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