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 1C967A0563; Wed, 15 Apr 2020 22:05:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1536C1DA27; Wed, 15 Apr 2020 22:04:50 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id BF6C21DA1C for ; Wed, 15 Apr 2020 22:04:46 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200415200446euoutp02c8d0a0f109de50aa41510e5c5028c641~GFuPGdipg1705517055euoutp021 for ; Wed, 15 Apr 2020 20:04:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200415200446euoutp02c8d0a0f109de50aa41510e5c5028c641~GFuPGdipg1705517055euoutp021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586981086; bh=+M3dS4Qpnb55Aqv8xspVBGIA7o3HHeQFPvOxmQ3OOrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHCOmRpIKjUjMouWXTY5gavulbTIP9ripA1LJyumxGBFUi1ibc5e1z78y+ICzhdn9 1uopgKZXTwxAkAMLEjgWsAc25ywTHOaY74QjM2AmVYMghGEm+3EVJmUijnRGDkIVwS dJfjuK9os5liPSPVD2/1bKx1b3NjVyHmlFL+U1mA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200415200446eucas1p1515d2757680c6821b1f5284e9f5cbbce~GFuO5Sg6Y0121801218eucas1p1I; Wed, 15 Apr 2020 20:04:46 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id D8.CC.60679.DD8679E5; Wed, 15 Apr 2020 21:04:45 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200415200445eucas1p2406d3f5b1794958c8345741c83d2000e~GFuOnke8Y1479414794eucas1p2l; Wed, 15 Apr 2020 20:04:45 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200415200445eusmtrp1963d596885047206ae6a87f39441e5d5~GFuOnBA_R2198521985eusmtrp1l; Wed, 15 Apr 2020 20:04:45 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-2e-5e9768dd11cb Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6B.C8.08375.DD8679E5; Wed, 15 Apr 2020 21:04:45 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200415200444eusmtip154784fa0bc3050b250ec433a9d0d50e3~GFuN7c6dB1837018370eusmtip1W; Wed, 15 Apr 2020 20:04:44 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org, maxime.coquelin@redhat.com, i.dyukov@samsung.com, v.kuramshin@samsung.com, amorenoz@redhat.com, zhihong.wang@intel.com, xiaolong.ye@intel.com, mb@smartsharesystems.com Cc: stable@dpdk.org Date: Wed, 15 Apr 2020 23:03:56 +0300 Message-Id: <20200415200423.6410-5-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200415200423.6410-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSfUhTURjGObt32504u03BV4uEQdCCnFnmLSoLpPZHkSQRCVm3dpumU7lX V9ofLknbVogf5MJIzYp0Qfkx1jS/mKLUZNaYqYj2QZGztC9D3Exq3kn/Pef3PIf3eQ+HwGR6 YTS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IWAicXj+LLYuRi4OIYGljBJLm+cydzFy ACUkJF4/YYaoEZb4c60LquYzo8T/K8vBEmwCGhKnO+YxgSREBI4zSvTO+s8EkmAG6mg/co0F xBYWsJXYtvcD2FAWAVWJlrlpIGFeAQuJK6tOQy2Ql1i94QCYzSlgKbHt0iE2EFtIIF1iSXcP 0wRGvgWMDKsYRVJLi3PTc4sN9YoTc4tL89L1kvNzNzECg3jbsZ+bdzBe2hh8iFGAg1GJh7fj 9bQ4IdbEsuLK3EOMEhzMSiK8O/ynxwnxpiRWVqUW5ccXleakFh9iNAW6aSKzlGhyPjDC8kri DU0NzS0sDc2NzY3NLJTEeTsEDsYAnZFYkpqdmlqQWgTTx8TBKdXAKMeqy32fe+LGS7u5CoPl Dd4eX+DQJCD0avb59XMinxfUx9hOY6hn4F4dvWs716zywA89D9/nx9rdm3ztzd12Uf5fr1ad D+J9vJv31q6ZZ3MKDZ2OpzB+CSjiMFoz62537rZFzHZT5/nxCrzy31zLEbLu6+tVaSZ/Yzj1 zJdNX304yFA77fy9L0osxRmJhlrMRcWJAAk8RHJ4AgAA X-CMS-MailID: 20200415200445eucas1p2406d3f5b1794958c8345741c83d2000e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200415200445eucas1p2406d3f5b1794958c8345741c83d2000e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200415200445eucas1p2406d3f5b1794958c8345741c83d2000e References: <20191212085012.9170-1-i.dyukov@samsung.com> <20200415200423.6410-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v10 4/6] net/virtio-user: fix devargs parsing 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" strtoull returns 0 if it fails to parse input string. It's ignored in get_integer_arg. This patch handles error cases for strtoull function. Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device") Cc: stable@dpdk.org Signed-off-by: Ivan Dyukov --- drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index e61af4068..a79f68a36 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -477,12 +477,17 @@ static int get_integer_arg(const char *key __rte_unused, const char *value, void *extra_args) { + uint64_t integer = 0; if (!value || !extra_args) return -EINVAL; - - *(uint64_t *)extra_args = strtoull(value, NULL, 0); - - return 0; + errno = 0; + integer = strtoull(value, NULL, 0); + /* extra_args keeps default value, it should be replaced + * only in case of successful parsing of the 'value' arg + */ + if (errno == 0) + *(uint64_t *)extra_args = integer; + return -errno; } static struct rte_eth_dev * -- 2.17.1