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 5FB4AA055F; Thu, 27 Feb 2020 15:20:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 70F961BFE0; Thu, 27 Feb 2020 15:20:29 +0100 (CET) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id AB0A11F1C for ; Thu, 27 Feb 2020 15:20:25 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200227142025euoutp0216303342da9b187c5a107565a14ec9ed~3SD4VGG_D2263122631euoutp02G for ; Thu, 27 Feb 2020 14:20:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200227142025euoutp0216303342da9b187c5a107565a14ec9ed~3SD4VGG_D2263122631euoutp02G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1582813225; bh=XZrkyRg2+Pz7PpyRdqYMptfy5QvNeuXSDMV/FIlv+bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2HWHHnwDOwhc6zupI/wM3MgEqYRWKKceiIw9mDst0fcnXwLqJhD1DRnWf9fL7TnI 3gqMOKhFg+k+qMdXW5Inuy2A7udFGx1W0oETAcGb71UJN7GECd2uIOUlKhl/1oTCZn t7y0Fjlr9oLKCcoaX6oQXdMPewZ7XsOSjIz2hIpY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200227142025eucas1p297cb80e014d7af0270579b52684d97c3~3SD38sDoR3188831888eucas1p2J; Thu, 27 Feb 2020 14:20:25 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 8F.C4.61286.920D75E5; Thu, 27 Feb 2020 14:20:25 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200227142024eucas1p1e356ee11b8eda65208682b1591e3cc00~3SD3t8CQZ2042620426eucas1p1H; Thu, 27 Feb 2020 14:20:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200227142024eusmtrp29273c2d3858ed5c96de872daa13c62a3~3SD3tb8h52816928169eusmtrp2J; Thu, 27 Feb 2020 14:20:24 +0000 (GMT) X-AuditID: cbfec7f2-ef1ff7000001ef66-ad-5e57d029c4fe Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2D.89.08375.820D75E5; Thu, 27 Feb 2020 14:20:24 +0000 (GMT) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200227142024eusmtip2e65d0e25452ec7484951187cd482439b~3SD3Hayax0717507175eusmtip2_; Thu, 27 Feb 2020 14:20:24 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com, amorenoz@redhat.com, zhihong.wang@intel.com, xiaolong.ye@intel.com Cc: Ivan Dyukov Date: Thu, 27 Feb 2020 17:16:15 +0300 Message-Id: <20200227141840.15835-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200227141840.15835-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMIsWRmVeSWpSXmKPExsWy7djPc7qaF8LjDNZvYbNo3fGAxeLdp+1M FrMuNbFbHOvcw2KxteE/k8WfN6YWmy9OYnJg9/i1YCmrx+I9L5k83u+7yubRt2UVYwBLFJdN SmpOZllqkb5dAlfGhDfnmQuecVQc2TCTvYF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KnO+YxgSREBPoZJTb++g2WYBZQk/jQ854FZJCwgI3ExaUeIGEWAVWJ DZNXsILYvAKWEm1XdjFBLJCXWL3hAFgrp4CVxPyWd4wgtpBAvMTH7+fZJzDyLWBkWMUoklpa nJueW2yoV5yYW1yal66XnJ+7iREYqNuO/dy8g/HSxuBDjAIcjEo8vAt2hMcJsSaWFVfmHmKU 4GBWEuHd+DU0Tog3JbGyKrUoP76oNCe1+BCjKdBRE5mlRJPzgVGUVxJvaGpobmFpaG5sbmxm oSTO2yFwMEZIID2xJDU7NbUgtQimj4mDU6qBcdLJe7JdZTNrHT77riwXkVQPLikx2CESY3Rs SoXXN4Pp1+VianrvS97nEbgi9iQ/xu/X76JdystLTn/ZKtVWaVv4TIL9ZGqD2As3mbL4xU6T 1h89xMh48Hbjrb/Vj/Uv/l7Ee83Ce0rmzMl7D536KHgzSuxNVrNDvq/Fsbs/tq19K8O5/lyB qhJLcUaioRZzUXEiAH+OvCBqAgAA X-CMS-MailID: 20200227142024eucas1p1e356ee11b8eda65208682b1591e3cc00 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200227142024eucas1p1e356ee11b8eda65208682b1591e3cc00 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200227142024eucas1p1e356ee11b8eda65208682b1591e3cc00 References: <20200226075503.GA108150@intel.com> <20200227141840.15835-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v5 3/4] 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 3fc172573..074527714 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -433,12 +433,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