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 86841A0562; Sun, 29 Mar 2020 16:44:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EFB2D1C036; Sun, 29 Mar 2020 16:43:40 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 42B851BFD7 for ; Sun, 29 Mar 2020 16:43:38 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200329144337euoutp02957a9e9db51bd75145ada031d0b0db5b~AzX-SMQ0k0963909639euoutp029 for ; Sun, 29 Mar 2020 14:43:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200329144337euoutp02957a9e9db51bd75145ada031d0b0db5b~AzX-SMQ0k0963909639euoutp029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585493017; bh=5tV+PUkbyK8uGKqGJo6atUhkYthNNopDlr81QODeU7I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V21XxP5VBu/f8jfL6vhcvJP7+io0FtYPjnZ0UctTItLTf4Miltyw7YtpMbXjCk6fj gwgQ8Mnvbep3X5xFYFHOD/G7U/7jK9FxGLuaoJFqrOFKwJaZV9CxbbPKrqR0oYJjlv iVC2rzo33qnPmSGldbhSCL6X752wMo0PrnMPCL/o= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200329144337eucas1p2a93632e03a276d9a31db92e169de8d9c~AzX_8wZk20561705617eucas1p2f; Sun, 29 Mar 2020 14:43:37 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id E1.A3.60679.914B08E5; Sun, 29 Mar 2020 15:43:37 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200329144337eucas1p2cc22be55d036822bf52dc69149d538af~AzX_u7-UK0846808468eucas1p2U; Sun, 29 Mar 2020 14:43:37 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200329144337eusmtrp28db350455c312456a18a3e56141fa6b1~AzX_uZiyp1656816568eusmtrp2U; Sun, 29 Mar 2020 14:43:37 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-72-5e80b4197a72 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 41.F7.07950.914B08E5; Sun, 29 Mar 2020 15:43:37 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200329144336eusmtip19f614961d7c2a094160dcdd87d41bef0~AzX_MVFB60056600566eusmtip1Q; Sun, 29 Mar 2020 14:43:36 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org, maxime.coquelin@redhat.com, i.dyukov@samsung.com, tiwei.bie@intel.com, amorenoz@redhat.com, zhihong.wang@intel.com, xiaolong.ye@intel.com Date: Sun, 29 Mar 2020 17:42:49 +0300 Message-Id: <20200329144308.5103-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200329144308.5103-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBIsWRmVeSWpSXmKPExsWy7djPc7qSWxriDI6+ELJo3fGAxeLdp+1M FrMuNbFbHOvcw2KxteE/k8WfN6YWmy9OYnJg9/i1YCmrx+I9L5k83u+7yubRt2UVYwBLFJdN SmpOZllqkb5dAlfGjKuXmQuecVTMunCfuYFxJnsXIyeHh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5lQ0kISxgI7Hm20pGkEEsAqoShy5LgIR5 BSwk/q5/xwIxVF5i9YYDYAs4BSwlJry/ywhiCwmkSxzcdYJpAiPvAkaGVYwiqaXFuem5xUZ6 xYm5xaV56XrJ+bmbGIEBue3Yzy07GLveBR9iFOBgVOLhNaisjxNiTSwrrsw9xCjBwawkwsvm 3xAnxJuSWFmVWpQfX1Sak1p8iNEU6KaJzFKiyfnAaMkriTc0NTS3sDQ0NzY3NrNQEuftEDgY A3RGYklqdmpqQWoRTB8TB6dUA+OSfuOvmQqhd458EK7p/79p/numqA0ns0xLGgUPiR1cHNKl 6nVsp0ja6+iifmfPfYdD4ves1FssM705cnpK5Fff09ubHWe/kjIWuWou+q3UYVN+fFlMz3S7 P6FmIhPF42OlvPS5C/+z3PCreOtxq2Fe55F+uw3u9VIL7mhz5TVWbprOKnthuxJLcUaioRZz UXEiAOAKfepeAgAA X-CMS-MailID: 20200329144337eucas1p2cc22be55d036822bf52dc69149d538af X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200329144337eucas1p2cc22be55d036822bf52dc69149d538af X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200329144337eucas1p2cc22be55d036822bf52dc69149d538af References: <20191212085012.9170-1-i.dyukov@samsung.com> <20200329144308.5103-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v7 3/5] 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. 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