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 A3E03A0588; Thu, 16 Apr 2020 07:54:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9610F1DAC0; Thu, 16 Apr 2020 07:53:33 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 694E31DAB4 for ; Thu, 16 Apr 2020 07:53:31 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200416055330euoutp014b736a281fc6f11cf5666802d6f05ba7~GNwRsUL0o2272122721euoutp01z for ; Thu, 16 Apr 2020 05:53:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200416055330euoutp014b736a281fc6f11cf5666802d6f05ba7~GNwRsUL0o2272122721euoutp01z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587016410; bh=+M3dS4Qpnb55Aqv8xspVBGIA7o3HHeQFPvOxmQ3OOrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBHDbG1o5QZIDFRM5DS6RIk291k3ivbW7kb8LGeHkjQHuzI75hoe8fg5U8oLO866y u3Gz428bwOJdighzU+gvzzU0kxU6/aY3qkiOjz4+QeVbFd0OhQMt/ph3Q4RDPtcjy6 w4Iz5gmFeiQqhyQiCnDE9I3eWb3PAPFeGAT/5xkY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200416055330eucas1p18423d78e1ef32118cbef9b5d8163a8e3~GNwRVWcp02727327273eucas1p1m; Thu, 16 Apr 2020 05:53:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id E4.85.60679.AD2F79E5; Thu, 16 Apr 2020 06:53:30 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200416055330eucas1p120bee1af98e108e09dd7515faf094c73~GNwRAt9kO2727227272eucas1p18; Thu, 16 Apr 2020 05:53:30 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200416055330eusmtrp1dcccfa72fe6b87b900b29d5ec9845df8~GNwRAEdaH2642726427eusmtrp1j; Thu, 16 Apr 2020 05:53:30 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-4a-5e97f2da4254 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 92.FE.08375.9D2F79E5; Thu, 16 Apr 2020 06:53:30 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200416055329eusmtip2c4d6e5c5b025b33be0e6d169634b50a9~GNwQT79Er2328223282eusmtip2_; Thu, 16 Apr 2020 05:53:29 +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 08:53:04 +0300 Message-Id: <20200416055309.19679-5-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200416055309.19679-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42LZduznOd1bn6bHGXy9ImbRuuMBi8W7T9uZ LGZdamK3ONa5h8Wi79dVRot/HX/YLU7f3Mxu8eeNqcXmi5OYHDg9fi1Yyuqxe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gl7GtiNuBTs4K/Y3XGVtYHzI3sXIySEhYCLx7+shFhBbSGApo8SrG9ldjBxAcQmJ 10+YIUqEJf5c62LrYuQCKvnMKHH920ZGkASbgIbE6Y55TCAJEYHjjBK9s/4zgSSYgTraj1wD GyosYCtxetNnNhCbRUBVoufXajCbV8BS4nn3KiaIDfISqzccANvGKWAlcaD7DBPEQRkSjR3H mCYw8i1gZFjFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGMLbjv3cvIPx0sbgQ4wCHIxKPLwd r6fFCbEmlhVX5h5ilOBgVhLh3eE/PU6INyWxsiq1KD++qDQntfgQoynQUROZpUST84HxlVcS b2hqaG5haWhubG5sZqEkztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgVFOS4qhYzlnm5LPnJy3 Nc9OaF04aKHwqi9NOsjZda/jn2VTNk4p4ojq0lkn16mR9uDjikkVeoyzRLgiXmbs1hbbm+lo d37+jfBf9u5/vIKazi76cOZs1M56HtlJnZ9kttiV7V5afrLL+atyi61/sH1boR1TpOXFFQa+ nxZI7enJfvn20YWdm5RYijMSDbWYi4oTAY4COOd3AgAA X-CMS-MailID: 20200416055330eucas1p120bee1af98e108e09dd7515faf094c73 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200416055330eucas1p120bee1af98e108e09dd7515faf094c73 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200416055330eucas1p120bee1af98e108e09dd7515faf094c73 References: <20191212085012.9170-1-i.dyukov@samsung.com> <20200416055309.19679-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH v11 4/6] 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