From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 42C108E8C for ; Mon, 31 Aug 2015 03:07:28 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 30 Aug 2015 18:07:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,436,1437462000"; d="scan'208";a="551670981" Received: from pgsmsx108.gar.corp.intel.com ([10.221.44.103]) by FMSMGA003.fm.intel.com with ESMTP; 30 Aug 2015 18:07:25 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 31 Aug 2015 09:07:24 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.248]) with mapi id 14.03.0224.002; Mon, 31 Aug 2015 09:07:17 +0800 From: "Ouyang, Changchun" To: Stephen Hemminger , "Xie, Huawei" Thread-Topic: [PATCH 3/3] virtio: fix possible NULL dereference Thread-Index: AQHQ4a3l0lohQ9DA60ORIu9nfAo28p4lTuqQ Date: Mon, 31 Aug 2015 01:07:17 +0000 Message-ID: References: <1440779019-10793-1-git-send-email-stephen@networkplumber.org> <1440779019-10793-4-git-send-email-stephen@networkplumber.org> In-Reply-To: <1440779019-10793-4-git-send-email-stephen@networkplumber.org> Accept-Language: zh-CN, 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 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 3/3] virtio: fix possible NULL dereference X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2015 01:07:28 -0000 > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Saturday, August 29, 2015 12:24 AM > To: Xie, Huawei; Ouyang, Changchun > Cc: dev@dpdk.org; Stephen Hemminger > Subject: [PATCH 3/3] virtio: fix possible NULL dereference >=20 > Found by Coverity. In virtio_dev_queue_release if the queue pointer is NU= LL, > then driver is dereferencing it to get hw pointer. > Also, don't do useless assignment >=20 > Signed-off-by: Stephen Hemminger Acked-by: Changchun Ouyang > --- > drivers/net/virtio/virtio_ethdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index 338d891..914c73d 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -239,15 +239,15 @@ virtio_set_multiple_queues(struct rte_eth_dev > *dev, uint16_t nb_queues) >=20 > void > virtio_dev_queue_release(struct virtqueue *vq) { > - struct virtio_hw *hw =3D vq->hw; >=20 > if (vq) { > + struct virtio_hw *hw =3D vq->hw; > + > /* Select and deactivate the queue */ > VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vq- > >queue_id); > VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_QUEUE_PFN, 0); >=20 > rte_free(vq); > - vq =3D NULL; > } > } >=20 > -- > 2.1.4