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 3427BA0524; Tue, 25 Feb 2020 08:31:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C33871BFE3; Tue, 25 Feb 2020 08:31:12 +0100 (CET) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 36DCC1BFE3 for ; Tue, 25 Feb 2020 08:31:11 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200225073111euoutp011827f2f0c86b946397e09e6667cd14a9~2lL-o6gc12036720367euoutp016 for ; Tue, 25 Feb 2020 07:31:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200225073111euoutp011827f2f0c86b946397e09e6667cd14a9~2lL-o6gc12036720367euoutp016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1582615871; bh=XZrkyRg2+Pz7PpyRdqYMptfy5QvNeuXSDMV/FIlv+bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFPmNKEIXN0uTvKHr5TGl84nP5VJvC6JLRmNM2RydTGbktXMTikhWAlLCgW5b7Ty1 iP+wfmwNo/cjYT/PMomwvMNc0f+GesiStZf927tM4YoIISyhKGP/DPMMc/6Sz+74KE nMhRLJxESW3vT52EwC98coc0f8X5CoSSLIFSFxdM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200225073110eucas1p22711265bd885ed90bc556411dbc169ea~2lL-gp9gH1194911949eucas1p23; Tue, 25 Feb 2020 07:31:10 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id E1.64.60679.E3DC45E5; Tue, 25 Feb 2020 07:31:10 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200225073110eucas1p2919a401942e01f3710de17730b16d400~2lL-Q8NZZ1056510565eucas1p28; Tue, 25 Feb 2020 07:31:10 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200225073110eusmtrp1cb8b2471a4e3d50948008853b1ad4bc5~2lL-QYGuS2163421634eusmtrp1Y; Tue, 25 Feb 2020 07:31:10 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-64-5e54cd3eb2f1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id E0.EA.08375.E3DC45E5; Tue, 25 Feb 2020 07:31:10 +0000 (GMT) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200225073110eusmtip2a73f06f9ba9bb9fee45fa8b6943468e6~2lL_w7mPA1466114661eusmtip2P; Tue, 25 Feb 2020 07:31:10 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com, amorenoz@redhat.com, zhihong.wang@intel.com Cc: Ivan Dyukov Date: Tue, 25 Feb 2020 10:28:12 +0300 Message-Id: <20200225072813.9385-4-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225072813.9385-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRmVeSWpSXmKPExsWy7djP87p2Z0PiDLqOGlu07njAYvHu03Ym i1mXmtgtjnXuYbHY2vCfyWLzxUlMDmwevxYsZfVYvOclk8f7fVfZPPq2rGIMYInisklJzcks Sy3St0vgypjw5jxzwTOOiiMbZrI3MM5k72Lk5JAQMJHo+ryC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yC6hJfOh5zwJiCwvYSGx5/wasnkVAVeLrkvlg Nq+AhcTfx/2sEAvkJVZvOAC2jFPAUmLzs8lgtpBAjsSLB1vZJjDyLWBkWMUoklpanJueW2yo V5yYW1yal66XnJ+7iREYoNuO/dy8g/HSxuBDjAIcjEo8vBJ7g+OEWBPLiitzDzFKcDArifB6 MwbFCfGmJFZWpRblxxeV5qQWH2I0BTpqIrOUaHI+MHrySuINTQ3NLSwNzY3Njc0slMR5OwQO xggJpCeWpGanphakFsH0MXFwSjUwyoZM+vs3Zeu0Kh9tQf2pLxZc/eHenBehJhtvG93313DS VrMVW0L+l7jzJ/Tc2H4jo/jpvI9zxe2tAmsKlEMsAgXUdf7pO61aZ3FxX9nKrs45YbZz68qq 2uSKEkRMpiW6PRXknvfBOllr6f/f3HO/SD4vyIy6121tZ1f+VlXqjLPUSbOlZx8psRRnJBpq MRcVJwIAmi+t2GYCAAA= X-CMS-MailID: 20200225073110eucas1p2919a401942e01f3710de17730b16d400 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200225073110eucas1p2919a401942e01f3710de17730b16d400 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200225073110eucas1p2919a401942e01f3710de17730b16d400 References: <20200225072813.9385-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v4 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