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 D5872A0577; Mon, 6 Apr 2020 10:59:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 296631BF4F; Mon, 6 Apr 2020 10:59:21 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 98F42F12 for ; Mon, 6 Apr 2020 10:59:19 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200406085919euoutp029a4871532bd8a64e75e66c38b57f235a~DL1ppRn0j1785017850euoutp02T for ; Mon, 6 Apr 2020 08:59:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200406085919euoutp029a4871532bd8a64e75e66c38b57f235a~DL1ppRn0j1785017850euoutp02T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586163559; bh=5tV+PUkbyK8uGKqGJo6atUhkYthNNopDlr81QODeU7I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ib1ls7H+/N8Yxy19az2QrsHrJWtuSgGh6kn+3PUVSRKWWP10kMmdxdAN8+RuMfJ2l SftXqFnaa5WSPV2XW/gQ5Ec+jnjty30NiLpXIhnmOcpep+N42Xc7doVecv8yWnNdUu pkP5l5DD9hkmE1QohAXVAdu/tSBV920RllQwdf0k= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200406085918eucas1p19a28e06bc80d1dc40e1eb1c2b9a2c387~DL1paoyBV1458014580eucas1p1P; Mon, 6 Apr 2020 08:59:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id E4.56.60698.66FEA8E5; Mon, 6 Apr 2020 09:59:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200406085918eucas1p200d058b72ac3e35b61dd1a119b9fcb55~DL1pGpNi61986919869eucas1p2x; Mon, 6 Apr 2020 08:59:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200406085918eusmtrp12ef9649904ec251c403b1994ab4aa9e6~DL1pGFtaB1258512585eusmtrp1C; Mon, 6 Apr 2020 08:59:18 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-b3-5e8aef66f06e Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6C.FC.08375.66FEA8E5; Mon, 6 Apr 2020 09:59:18 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200406085917eusmtip231ed9b9da99bac7f49b5440fba4d1080~DL1ohsBCY2530225302eusmtip2X; Mon, 6 Apr 2020 08:59:17 +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 Date: Mon, 6 Apr 2020 11:58:01 +0300 Message-Id: <20200406085855.25773-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200406085855.25773-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEIsWRmVeSWpSXmKPExsWy7djP87pp77viDH480rNo3fGAxeLdp+1M FrMuNbFbHOvcw2LR9+sqo8Xpm5vZLf68MbXYfHESkwOHx68FS1k9Fu95yeTxft9VNo++LasY PU496mYOYI3isklJzcksSy3St0vgyphx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k Xj9hhqgRlvhzrYsNouYzo8SO6adYQRJsAhoSpzvmMYEkRASOM0r0zvrPBJIQFrCR+PzuPCPI IBYBVYkfDf4gYV4BS4mzU+ewQgyVl1i94QDYAk4BK4kpe/6C7RUSyJDY+DBvAiPvAkaGVYwi qaXFuem5xYZ6xYm5xaV56XrJ+bmbGIEhuu3Yz807GC9tDD7EKMDBqMTDy3C7M06INbGsuDL3 EKMEB7OSCK9UL1CINyWxsiq1KD++qDQntfgQoynQSROZpUST84Hxk1cSb2hqaG5haWhubG5s ZqEkztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgbFCWyMh8G79moNfgk/YH3i7yeG/y5uKt1vW rL1tauVa8vCgm8fM2t9uEZK9KgJNDxtX9UWe/bfRhSdq5jklgxQH3eKZ0zhqbmRxh1X8++uU aqjXWPLU16lj1WX+fWZen1tOpb67p7SIK0vMLCj+6W3jy8Kaey78Ovf/5r/Vq3s5nD+zKTnN eKDEUpyRaKjFXFScCACgWi+7ZwIAAA== X-CMS-MailID: 20200406085918eucas1p200d058b72ac3e35b61dd1a119b9fcb55 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200406085918eucas1p200d058b72ac3e35b61dd1a119b9fcb55 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200406085918eucas1p200d058b72ac3e35b61dd1a119b9fcb55 References: <20191212085012.9170-1-i.dyukov@samsung.com> <20200406085855.25773-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v9 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