From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 74C311B7BB; Fri, 9 Feb 2018 02:51:43 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2018 17:51:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,481,1511856000"; d="scan'208";a="26012962" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 08 Feb 2018 17:51:42 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 8 Feb 2018 17:51:42 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 8 Feb 2018 17:51:41 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Fri, 9 Feb 2018 09:51:37 +0800 From: "Tan, Jianfeng" To: "Kulasek, TomaszX" , "yliu@fridaylinux.org" CC: "dev@dpdk.org" , "stable@dpdk.org" , "Wodkowski, PawelX" Thread-Topic: [PATCH] vhost: fix check if cmsg is NULL Thread-Index: AQHToP7tn5QswLen7k2p8PyOMR8hmKObRllA Date: Fri, 9 Feb 2018 01:51:37 +0000 Message-ID: References: <20180208170322.52568-1-tomaszx.kulasek@intel.com> In-Reply-To: <20180208170322.52568-1-tomaszx.kulasek@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] vhost: fix check if cmsg is NULL 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: , X-List-Received-Date: Fri, 09 Feb 2018 01:51:45 -0000 Hi Tomasz, > -----Original Message----- > From: Kulasek, TomaszX > Sent: Friday, February 9, 2018 1:03 AM > To: yliu@fridaylinux.org > Cc: dev@dpdk.org; Tan, Jianfeng; stable@dpdk.org; Wodkowski, PawelX > Subject: [PATCH] vhost: fix check if cmsg is NULL >=20 > Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer") Firstly, this fix line is incorrect. It shall be: Fixes: 8f972312b8f4 ("vhost: support vhost-user") > Cc: jianfeng.tan@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Pawel Wodkowski > Signed-off-by: Tomasz Kulasek > --- > lib/librte_vhost/socket.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index 83befdced..8fd47a4d8 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -153,6 +153,11 @@ send_fd_message(int sockfd, char *buf, int buflen, > int *fds, int fd_num) > msgh.msg_control =3D control; > msgh.msg_controllen =3D sizeof(control); > cmsg =3D CMSG_FIRSTHDR(&msgh); I suppose it will not return NULL as the control is defined as a variable-l= ength array. But no harm to check it. Thanks, Jianfeng > + if (cmsg =3D=3D NULL) { > + RTE_LOG(ERR, VHOST_CONFIG, "cmsg =3D=3D NULL\n"); > + errno =3D EINVAL; > + return -1; > + } > cmsg->cmsg_len =3D CMSG_LEN(fdsize); > cmsg->cmsg_level =3D SOL_SOCKET; > cmsg->cmsg_type =3D SCM_RIGHTS; > -- > 2.14.1