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 8C1D9A0350; Thu, 25 Jun 2020 22:32:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27CF61B6B4; Thu, 25 Jun 2020 22:32:23 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 28B91AAD5 for ; Thu, 25 Jun 2020 22:32:20 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id f3so3874167pgr.2 for ; Thu, 25 Jun 2020 13:32:20 -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=WzOcCtjnwa2naFCeEd4Qe+4DYmP/hml3PDkyllYs25o=; b=lAyRnkxO4ElArlBGPdJ9S//mXmHERu33FArc61aas96ZlYQUuDK17xCusFMwx6Q5t7 BoRuSy2GMtccYDSJiDie+39OR1wGTrS0V5qxYELSM93hvt4A2el1z005vi9DrokBFd+3 /kGGCBsVHwqwqQxCRV/JWfIKRncKXfripUxAC3O4oIOZGXV6yO90wE206nKJXHqHOq0N fDylXv6Qi6PxsrNslDKqoDo/GYXBr6T/JdKxOaCajCfHsfF4G2vPNpsI3OSmAoyz3hp+ oN7XnE9lgAviqPJzjZzqsLkTxmrTjFlSbTjW0n4xhbJ5tTLy30lTQF0bQiJsXLg8BmUc 0dHg== 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=WzOcCtjnwa2naFCeEd4Qe+4DYmP/hml3PDkyllYs25o=; b=TzLJcOXWJUnpbRASNe2qhPXq5bPb89GbsRnw1sSW5DDIx3dhHukTvSKGQdXQNyecTj 4xqpXv91RmDFvFqPisa+eX68RrUFNfKj6B011p1KAh0yamf6CgWjwZQF8z+c1NQSPTDB BblRocdlu9GqPWnissKCyb/4Yl475FCR3p+MGfScbhv700JFKbHYrhjCAJVPTIFDFbhK EFC8hm9CYgmqU+d2129oF4Cws+QGTDFMkAJj6p8bKYnUdggRWyqpjTwI5H3hmVVdWj15 +qHM2zrrILydLq25hdue/GeKmGsCroBtZHXxqFKinreAMXDum7XyQ5vLyC1POpYZ2ib8 2pCw== X-Gm-Message-State: AOAM531xvBN1BHDMPB95lRo5xlauvgrdcOcn9xVOsaRWAu3gOjN1GTj9 MWzW9ocmHuH1BDPl7iz2T78m85gvmag= X-Google-Smtp-Source: ABdhPJwE0O/oW5NZQWegidnXIVLb7Fg3rDQ8QsB/srJ/nUCOySsOICeTC7rgSkGGh0hkvZWEVQ/tKQ== X-Received: by 2002:a63:4144:: with SMTP id o65mr27419811pga.8.1593117139385; Thu, 25 Jun 2020 13:32:19 -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 i12sm23963007pfk.180.2020.06.25.13.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 13:32:18 -0700 (PDT) From: Stephen Hemminger To: "Medvedkin, Vladimir" Cc: dev@dpdk.org, Stephen Hemminger Date: Thu, 25 Jun 2020 13:32:07 -0700 Message-Id: <20200625203208.19315-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200625203208.19315-1-stephen@networkplumber.org> References: <20200625203208.19315-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/3] rib: check for invalid max_nodes 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" Max_nodes in config is signed, but a negative value makes no sense. Get rid of extra BSD style parens. Signed-off-by: Stephen Hemminger --- lib/librte_rib/rte_rib.c | 3 +-- lib/librte_rib/rte_rib6.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_rib/rte_rib.c b/lib/librte_rib/rte_rib.c index e40cf715c099..2a370d7f8439 100644 --- a/lib/librte_rib/rte_rib.c +++ b/lib/librte_rib/rte_rib.c @@ -401,8 +401,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf) struct rte_mempool *node_pool; /* Check user arguments. */ - if ((name == NULL) || (conf == NULL) || - (conf->max_nodes == 0)) { + if (name == NULL || conf == NULL || conf->max_nodes <= 0) { rte_errno = EINVAL; return NULL; } diff --git a/lib/librte_rib/rte_rib6.c b/lib/librte_rib/rte_rib6.c index 02563b951620..f6c55ee454be 100644 --- a/lib/librte_rib/rte_rib6.c +++ b/lib/librte_rib/rte_rib6.c @@ -460,8 +460,7 @@ rte_rib6_create(const char *name, int socket_id, struct rte_mempool *node_pool; /* Check user arguments. */ - if ((name == NULL) || (conf == NULL) || - (conf->max_nodes == 0)) { + if (name == NULL || conf == NULL || conf->max_nodes <= 0) { rte_errno = EINVAL; return NULL; } -- 2.26.2