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 B5E7DA0567; Wed, 10 Mar 2021 14:29:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5590722A618; Wed, 10 Mar 2021 14:28:44 +0100 (CET) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id 1323122A5C2 for ; Wed, 10 Mar 2021 14:28:43 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id EF72E19D0; Wed, 10 Mar 2021 08:28:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 10 Mar 2021 08:28:42 -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=PfM1Tv7mRxtRA 4D7IPXrv/zZRCj9MgP6zqEJsYDJesk=; b=DHYL/BbjHxVFGSsjZWBqZW4m93TVd 6Il/6EeFa183xI/HvtvHY8G93IlKE/2zfQQUZDjFBLMKvln/QeujF/4gtfoFBV3b bg6rjt6RWTC4LmxBNvhXQ6iSy6QA66O6QTi/FQVTyag+gQT/Fqr+/E3oBMYhY0aj qoXdIdVhEpDTs8IKrKJq8O7aHFWXYms1Ocii/U1wQcGlvWnTHfAbtYkYRSIukVf+ aeG/XXRR4mNkt8PHcdxLjTPXMAJ6Azavauaw+Vg2/zmLf2ZbDcbV+db9XHuJhFcb d6APpk8SUe/VutVz3GtRFBEXGWkA6D4QMz+o3QhYQd1Yo73soIVlA4P2w== 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=PfM1Tv7mRxtRA4D7IPXrv/zZRCj9MgP6zqEJsYDJesk=; b=CIeWi9AW m+5sQbcYFOLT9ixr1dQr3LauR9+oCw3pI9IlC6Odu9J6sL4VzzEiL5Gc7CPA/w+3 MO/avt3kBkOtzp6svaFPedUVsjZ/gs22bJCoqX0nnZ5SCPqJShet/x7mP8EOsvKy Isj+hCDjYfpyqI7aG3wdZpg61howKg5/S/FcTtkSK84ggdusG+2G5+Vk/64GDgIR R9mWhHYpOsquzVAiziwgZjMFvmiRdtjvgJNeWXEnhcji84PCJnFTJBkEik8XtKOg n+zeK2Hlyzl0Es4b7yiqd4YkldHdCMf7I6B7HEwKdZ/gg8iSp0/1sps7QZaNXSqc HBL2OZt/ippTdA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddukedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvhefgiedvjeegtdevhe efhfetleefgfeivefgffevfeejgedtgfeutdehtdegveenucfkphepjeejrddufeegrddv tdefrddukeegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 3A5C924005E; Wed, 10 Mar 2021 08:28:41 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com Date: Wed, 10 Mar 2021 14:28:20 +0100 Message-Id: <20210310132825.2627851-7-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210310132825.2627851-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210310132825.2627851-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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 3675e55fc9..da0aaf831e 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