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 102B8A04F0; Mon, 13 Jan 2020 03:16:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B32ED1D57D; Mon, 13 Jan 2020 03:16:09 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 37D511D578; Mon, 13 Jan 2020 03:16:08 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2020 18:16:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,427,1571727600"; d="scan'208";a="247576041" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.74]) by fmsmga004.fm.intel.com with ESMTP; 12 Jan 2020 18:16:04 -0800 Date: Mon, 13 Jan 2020 10:16:05 +0800 From: Tiwei Bie To: Yunjian Wang Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, xudingke@huawei.com, stable@dpdk.org Message-ID: <20200113021605.GA84114@___> References: <1578572304-2296-1-git-send-email-wangyunjian@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1578572304-2296-1-git-send-email-wangyunjian@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] net/virtio-user: fix return value of tap offload sets not checked 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" On Thu, Jan 09, 2020 at 08:18:24PM +0800, Yunjian Wang wrote: > The function vhost_kernel_tap_set_offload() could return errors, > the return value need to be checked. And there is no need to fail > when error is -ENOTSUP. > > Fixes: 1db4d2330bc8 ("net/virtio-user: check negotiated features before set") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > v2: > * No need to fail when error is -ENOTSUP. > --- > drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c > index 76bf75423..2a0c2106d 100644 > --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c > +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c > @@ -66,6 +66,7 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, > int sndbuf = INT_MAX; > struct ifreq ifr; > int tapfd; > + int ret; > > /* TODO: > * 1. verify we can get/set vnet_hdr_len, tap_probe_vnet_hdr_len > @@ -131,7 +132,9 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, > goto error; > } > > - vhost_kernel_tap_set_offload(tapfd, features); > + ret = vhost_kernel_tap_set_offload(tapfd, features); > + if (ret < 0 && ret != ENOTSUP) s/ENOTSUP/-ENOTSUP/ > + goto error; > > memset(&ifr, 0, sizeof(ifr)); > ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; > -- > 2.19.1 > >