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 BE3CCA0588; Thu, 16 Apr 2020 14:44:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B6E4A1DC51; Thu, 16 Apr 2020 14:43:23 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id AC9561DC6C for ; Thu, 16 Apr 2020 14:43:18 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200416124318euoutp028d9c5423b7220309d9a8999f355953ee~GTWEtNNBB0059000590euoutp02T for ; Thu, 16 Apr 2020 12:43:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200416124318euoutp028d9c5423b7220309d9a8999f355953ee~GTWEtNNBB0059000590euoutp02T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587040998; bh=+M3dS4Qpnb55Aqv8xspVBGIA7o3HHeQFPvOxmQ3OOrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Elrpji8m3MKQ4xr9Tb+Vsuii6qSafggdwFrEw0WDvxS5VRGnT24wITLpzD+Kp9vaX AECmLJpuN7ZzF1JNhLj+y9GiaeRgnn68KzsLvKH+N2VqNJy8GXw46GTrDC1ytEzFXF sNg2piE9oI/PaC87pfGuhIAJSVTASq7zv4TpKNys= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200416124318eucas1p203356aff1971b17b011997153b010524~GTWEdr6Il1709217092eucas1p2Q; Thu, 16 Apr 2020 12:43:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 86.4E.60698.6E2589E5; Thu, 16 Apr 2020 13:43:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200416124317eucas1p15276ceb13bfb49ba429e4391d1ecce53~GTWEImOb-1957419574eucas1p1Z; Thu, 16 Apr 2020 12:43:17 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200416124317eusmtrp171b75f513e6b092578a51af5202a664e~GTWEIA1G60947209472eusmtrp1J; Thu, 16 Apr 2020 12:43:17 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-bf-5e9852e6f9db Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D2.D8.07950.5E2589E5; Thu, 16 Apr 2020 13:43:17 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200416124317eusmtip2ddce9a53b1dea6657bfa55fdd966a899~GTWDe09Tv0292802928eusmtip2W; Thu, 16 Apr 2020 12:43: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 Cc: stable@dpdk.org Date: Thu, 16 Apr 2020 15:42:56 +0300 Message-Id: <20200416124258.15549-6-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200416124258.15549-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42LZduzned1nQTPiDO7NYrdo3fGAxeLdp+1M FrMuNbFbHOvcw2LR9+sqo8W/jj/sFqdvbma3+PPG1GLzxUlMDpwevxYsZfVYvOclk8f7fVfZ PPq2rGL0O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hgKaPE/2X1XYwcQHEJ iddPmCFKhCX+XOti62LkAir5zCixa9JvsHo2AQ2J0x3zmEASIgLHGSV6Z/1nAkkwA3W0H7nG AmILC9hK3Pi8jRHEZhFQlbi0rgnM5hWwlOhY3QJ1hLzE6g0HwLZxClhJ3O1+BXVQhsTCS49Z JjDyLWBkWMUoklpanJueW2ykV5yYW1yal66XnJ+7iREYxNuO/dyyg7HrXfAhRgEORiUe3gT7 GXFCrIllxZW5hxglOJiVRHj5TIFCvCmJlVWpRfnxRaU5qcWHGE2BjprILCWanA+MsLySeENT Q3MLS0NzY3NjMwslcd4OgYMxQgLpiSWp2ampBalFMH1MHJxSDYxzPdMia7vZ9/K0657+Me/w pg2L17zPjHR7cCuDwer54ayFt099XbLpDU9rCP+/pZ2zu+vimNwSnp6texNSq7po1Z/Aqr0p YTv+yRZfl3TW/ved4Xod78P+MAuxbM1bln2H3PZlSsS+F/HdqfYgPCLj8pTK+Nq7rbn/onnN up/X/+hxmvEv74gSS3FGoqEWc1FxIgBrkhAkeAIAAA== X-CMS-MailID: 20200416124317eucas1p15276ceb13bfb49ba429e4391d1ecce53 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200416124317eucas1p15276ceb13bfb49ba429e4391d1ecce53 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200416124317eucas1p15276ceb13bfb49ba429e4391d1ecce53 References: <20191212085012.9170-1-i.dyukov@samsung.com> <20200416124258.15549-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v12 5/7] 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. Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device") Cc: stable@dpdk.org 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