From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49C9CA0567; Wed, 10 Mar 2021 00:32:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D4D622A574; Wed, 10 Mar 2021 00:31:50 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id 40E5622A562 for ; Wed, 10 Mar 2021 00:31:48 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id E88EE5C00DA; Tue, 9 Mar 2021 18:31:47 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 09 Mar 2021 18:31:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=0xs2IAaTgL6HT /xMrWNsYiqDG2Orh6fzmx2zBcidIrE=; b=wpi7BeOhE6yf4peqT1PaCF2vDvZO7 rAUHn0FddzVyngifkfpoRd4XB3Kpau6nj0R9WN4vFJHJVsODyVVRN7SrKTvRzQ/B 9l0FJsvA716BLFirZ9NAlCKgeknq+6vx7jwQqdWPbHVz1GZP0+vqJVJU2aGtKFc2 bagT9VsOuNj+DECs81GjL2t76WpUI056v3QQ+jDVjEiuCqrFrcV6gKPdeG6mjRho kCiDxmq7tkn3RtrM722sSOq6FPib+OQKSs6IqTT8UoAwGXGoAyVzzroP1QWRkJzK ueso6K0PzOc9v7vJI9to77/O1CPFaKVVgNOFy4nLaWuWZktIWT6VkGiXQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=0xs2IAaTgL6HT/xMrWNsYiqDG2Orh6fzmx2zBcidIrE=; b=YryC2s2X hjVsjm5LI+F2mSp+CjN3GgzHkgCQnLRGpURRJ15E9PmGu41Jxjud5qBqG03wRUZs sXO8HMMqONViTnAjx7Dpe+vL3qmuU22CJvDN+4z1zPuMtdHeAr3nwoC1BLAYB0vT 9Sidpjhc5SNBT6a3Xa9BJPnuc6MftMhpVvC6jQwRSrlNHwjOV90NNXMMieZ0fcAt gsYlu1qKjW0yCVBFSZr0Qvv747voA2LkBIiP2MMdwtYoQteM762Y5XUNLl7i4mM7 LpGxRtXZQvMZyhAoyyWI7vZuqZbhb92iEfpMpfAJjPb56UjJjDzb/S9RRvR7rdDA UiPYgsezgXtx+w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudduiedgudejgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghs sehmohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdehgfeivdejgedtve ehfefhteelfefgieevgfffveefjeegtdfguedthedtgeevnecukfhppeejjedrudefgedr vddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8912824005B; Tue, 9 Mar 2021 18:31:47 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com Date: Wed, 10 Mar 2021 00:31:10 +0100 Message-Id: <20210309233116.1934666-7-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210309233116.1934666-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 06/11] eal: catch invalid log level number X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The parsing check for invalid log level was not trying to catch irrelevant numeric values. A log level 0 or too high is now a failure in options parsing so it can be caught early. Signed-off-by: Thomas Monjalon --- lib/librte_eal/common/eal_common_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index febc99612a..5b9ce286ff 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -1289,7 +1289,7 @@ eal_parse_log_level(const char *arg) } priority = eal_parse_log_priority(level); - if (priority < 0) { + if (priority <= 0 || priority > (int) RTE_LOG_MAX) { fprintf(stderr, "invalid log priority: %s\n", level); goto fail; } -- 2.30.1