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 C9C18A0562; Mon, 30 Mar 2020 09:58:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 510B41C0AA; Mon, 30 Mar 2020 09:58:35 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 3C4F41C07B for ; Mon, 30 Mar 2020 09:58:32 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200330075832euoutp02be92325493e31e038f7ab40110d3beb2~BBflKNACC0173601736euoutp02w for ; Mon, 30 Mar 2020 07:58:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200330075832euoutp02be92325493e31e038f7ab40110d3beb2~BBflKNACC0173601736euoutp02w DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585555112; bh=5tV+PUkbyK8uGKqGJo6atUhkYthNNopDlr81QODeU7I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KSZwk8ahEgD9+p5AXB3SkKWZ8lYIAa61YvLgbtc2LAXSB37wJ4DKzBW6k2pn1tlwx 0zsca4SUnmHPPkUN2lI6IZ5q+yLGbFRccVRBGruvARxOh2oOiqxMEFBYnNtwiyjByK pbtQQ+nfCnV8huu0fjvyGTLG09kVjlza6tavRR9s= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200330075831eucas1p1cba36087ba7162d0b71ae241de074895~BBfk7nwJX0921409214eucas1p1H; Mon, 30 Mar 2020 07:58:31 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 34.FE.60679.7A6A18E5; Mon, 30 Mar 2020 08:58:31 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200330075831eucas1p22cd157c9ba83fa3b6c0fa85ba37f1bb4~BBfktiABU2833228332eucas1p28; Mon, 30 Mar 2020 07:58:31 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200330075831eusmtrp1c80d1015c96a2f72ae9eea155b0e6430~BBfks-hTw2775327753eusmtrp1V; Mon, 30 Mar 2020 07:58:31 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-7c-5e81a6a718ec Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 56.DF.07950.7A6A18E5; Mon, 30 Mar 2020 08:58:31 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200330075830eusmtip2d7acd24f5946ca4dc81e0549fb16e104~BBfkG3MVt3056530565eusmtip2h; Mon, 30 Mar 2020 07:58:30 +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: Mon, 30 Mar 2020 10:58:00 +0300 Message-Id: <20200330075814.6857-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330075814.6857-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsWy7djPc7rLlzXGGdw5oW/RuuMBi8W7T9uZ LGZdamK3ONa5h8Via8N/Jos/b0wtNl+cxOTA7vFrwVJWj8V7XjJ5vN93lc2jb8sqxgCWKC6b lNSczLLUIn27BK6MGVcvMxc846iYdeE+cwPjT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A2k0VAVaLp6REwm1fAQqL/ bQ8rxFB5idUbDoAt4BSwlDgzcSsTxIJ0icbbHUwTGHkXMDKsYhRJLS3OTc8tNtIrTswtLs1L 10vOz93ECAzHbcd+btnB2PUu+BCjAAejEg/vjK0NcUKsiWXFlbmHGCU4mJVEeNn8gUK8KYmV ValF+fFFpTmpxYcYTYGOmsgsJZqcD4yVvJJ4Q1NDcwtLQ3Njc2MzCyVx3g6BgzFAZySWpGan phakFsH0MXFwSjUwqqxq3b9w/t/lK54YfjmkGRue8MrzSa9o+PqU/PM/r3vnz7iY8cLjrLz9 19Ul8VP8Z7x6rzhxZ4qfjrDJ1qfWnbt6b04PYr19tkDEIWyZbjOPrUHTz3Cn18kb+/tPaCQ2 XnzgbeapOa28d9NzcaYy7UCvyVMPLjiuVlf+naH5Q9gKt4VT3OxuKrEUZyQaajEXFScCAL7P zU9dAgAA X-CMS-MailID: 20200330075831eucas1p22cd157c9ba83fa3b6c0fa85ba37f1bb4 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200330075831eucas1p22cd157c9ba83fa3b6c0fa85ba37f1bb4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200330075831eucas1p22cd157c9ba83fa3b6c0fa85ba37f1bb4 References: <20191212085012.9170-1-i.dyukov@samsung.com> <20200330075814.6857-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v8 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