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 E2ACFA056A; Tue, 3 Mar 2020 19:29:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E58E1C02D; Tue, 3 Mar 2020 19:29:11 +0100 (CET) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 8E22A1C021 for ; Tue, 3 Mar 2020 19:29:09 +0100 (CET) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200303182908euoutp01374aacb9e0336a99c049f1dc3aa2e99e~43reDE-UE2026920269euoutp01X for ; Tue, 3 Mar 2020 18:29:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200303182908euoutp01374aacb9e0336a99c049f1dc3aa2e99e~43reDE-UE2026920269euoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1583260148; bh=XZrkyRg2+Pz7PpyRdqYMptfy5QvNeuXSDMV/FIlv+bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjB41ny7M4Z9AelZ7eqo24N4K15KyO3ZApIRi5G+VjVSGcf5Nl8HJWRVNKI//sEGv whkc+YEMGcVy7mgyxbeKOw65DJ1yT1iNCj15IAEkPAyely9o7Nz9ljUE2eL2gbS6Il G8sf9JlVDwIQcYG1hz/VUtsJLeQcDqlMBo2k+Iio= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200303182907eucas1p29dab3e1743cf6fc299578fecbc4571f1~43rdCxd6l0069500695eucas1p2H; Tue, 3 Mar 2020 18:29:07 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 2D.AC.61286.3F1AE5E5; Tue, 3 Mar 2020 18:29:07 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200303182906eucas1p2a80e3e02c52746e750c743accda56d34~43rcX3HFT0069500695eucas1p2G; Tue, 3 Mar 2020 18:29:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200303182906eusmtrp2258e4b5eb017dea2bc5e685d773559f9~43rcXTjj_0347103471eusmtrp2l; Tue, 3 Mar 2020 18:29:06 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-56-5e5ea1f3c4f7 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 3B.A4.07950.2F1AE5E5; Tue, 3 Mar 2020 18:29:06 +0000 (GMT) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200303182906eusmtip1ec375943a26c44fca2a2f38a46c57cb4~43rb0vQ-H1574315743eusmtip1c; Tue, 3 Mar 2020 18:29:06 +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: Tue, 3 Mar 2020 21:27:04 +0300 Message-Id: <20200303182846.26109-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200303182846.26109-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMIsWRmVeSWpSXmKPExsWy7djP87qfF8bFGSzqVLdo3fGAxeLdp+1M FrMuNbFbHOvcw2KxteE/k8WfN6YWmy9OYnJg9/i1YCmrx+I9L5k83u+7yubRt2UVYwBLFJdN SmpOZllqkb5dAlfG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uu qJrPjBJzZp8GS7AJaEic7pjHBJIQEehnlNj46zdYgllATeJDz3sWkEHCAjYS979ngZgsAqoS 9zcUgJi8ApYS7095QIyXl1i94QBYI6eAlcSJO20sEKsaGCU27FrMMoGRbwEjwypGkdTS4tz0 3GIjveLE3OLSvHS95PzcTYzAMN127OeWHYxd74IPMQpwMCrx8Ep4xsUJsSaWFVfmHmKU4GBW EuH15YyOE+JNSaysSi3Kjy8qzUktPsRoCnTTRGYp0eR8YAzllcQbmhqaW1gamhubG5tZKInz dggcjBESSE8sSc1OTS1ILYLpY+LglGpg3Jsh5KM3ba/Vs6M60ryzLx348aAi2tz7m1f1pcu9 dfzPzHc+fMCp+XLl1RnflPe/v7DdM9aZxWHa8yNN6j4NoW3bDGT0D2zf4Hs4bdrzS9X3BIss LeRfCyWWRXpUblxb+9eqR9eqZVluRZjD+hm/PtgFzny9ftrSbbKvnj1/t9ejRIunPXADqxJL cUaioRZzUXEiAJeWdahpAgAA X-CMS-MailID: 20200303182906eucas1p2a80e3e02c52746e750c743accda56d34 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200303182906eucas1p2a80e3e02c52746e750c743accda56d34 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200303182906eucas1p2a80e3e02c52746e750c743accda56d34 References: <20200303182846.26109-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v6 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