From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B9CBA00C2; Thu, 6 Oct 2022 09:22:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CD8E4280E; Thu, 6 Oct 2022 09:22:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7A74441153; Thu, 6 Oct 2022 09:22:26 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 295LG1Rl020615; Thu, 6 Oct 2022 00:22:20 -0700 Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3k17uhbxy8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Oct 2022 00:22:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XSlLje33LHqQWI5YzH5SUmvbCYuP7sTUpjaFo4JkaQNS+EhkKRhi2Ws2wkSWUMI3cJeKMbPe/31l8ck0FquD0632SvX6n1fYSx5+vZ11uR7XvudVcJ9PVMgKN4h74tIUT/vEvt+rii/teLKj5BSUUkugb/HdA7bNE2Ue+Z5cEtc0poaNdy6EA5gGZIym2Iu3EoNhsPi9MRZq1Vp9DswzNL74rlU+/0rCgifJrRExX0u21DF6wUUlxBAgq7x70mfJefFpDSIVEu+WxoxiwGMPOPMX1Z0AqPYrAbvBPyyCTXK9pDSqYPL6exc0iuNBWvQszHECJLzGIv5C7jPgGb4shA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ivsjsEhF0H/3ClhuxcfUmXMdPulOXFKMRUj5qmVGx3Y=; b=I+nH/v9MPZaET7Bo0yupbdN54SFnVDtm3YIE73pSD5I6SZXqW5UCB41MA+orwGddX4hdixneMCix9H2HCKkq30vY7PoSwDYmoGdhDJNiJDVK/n2CFUmwajrH8XI69gUVBMtAAgYv1Fk+0yjGXTHOK8QdoC/HjY8NEVOmFVNKU33y+3ggtfJxDDoc+nbIdbnTev66AZTqJdkJ1tob7qnH72R6ZX+ajXwC6muW0exE2DCj0HX045vcdvaFknO+RE2wZnOOhz/uqzu8tPlBjbo/VGBU4YfnKtoFBOXQuXsqLQz/bE2YqB4XVB0H+kJBoEI8ZJwiaL1r5/Q8cKA7RSGaSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ivsjsEhF0H/3ClhuxcfUmXMdPulOXFKMRUj5qmVGx3Y=; b=bEwNYKWImQBX4CXiJu3LsZoNq7IP8Mc00ygO6xwgJqCrOYzrS3rhsnGcqnGMB52gbaPbpZ4W6ijO5W3nNHJwDE1rTzVV9Hww3JPD0ID1HJyH7KFPcHP8IRf1wzGyn3+a62VtBB5rBg15VcSe1xxQJGvq5J+Zs0oWaQ5cXnpfU6Y= Received: from PH0PR18MB5167.namprd18.prod.outlook.com (2603:10b6:510:168::7) by MN2PR18MB3653.namprd18.prod.outlook.com (2603:10b6:208:26b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Thu, 6 Oct 2022 07:22:18 +0000 Received: from PH0PR18MB5167.namprd18.prod.outlook.com ([fe80::39e7:fb99:16b:c1a6]) by PH0PR18MB5167.namprd18.prod.outlook.com ([fe80::39e7:fb99:16b:c1a6%3]) with mapi id 15.20.5676.030; Thu, 6 Oct 2022 07:22:18 +0000 From: Amit Prakash Shukla To: Amit Prakash Shukla , Maxime Coquelin , Chenbo Xia CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , "stable@dpdk.org" , "Ruifeng.Wang@arm.com" Subject: RE: [PATCH v3] vhost: compilation fix for GCC-12 Thread-Topic: [PATCH v3] vhost: compilation fix for GCC-12 Thread-Index: AQHYvt2ehv2vAKhmsUuyz5lTP5TjwK4BKJcg Date: Thu, 6 Oct 2022 07:22:18 +0000 Message-ID: References: <20220901084943.3075710-1-amitprakashs@marvell.com> <20220902150622.3233855-1-amitprakashs@marvell.com> In-Reply-To: <20220902150622.3233855-1-amitprakashs@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR18MB5167:EE_|MN2PR18MB3653:EE_ x-ms-office365-filtering-correlation-id: ed5bafa2-8df1-45e8-b72b-08daa76b804a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: heHeNK27hxbvnVx/Ry+47Sk714bXe0WozzS8Sg35IYm165J6lxiJIr3nUpJ/4Noj8iHh+CYy47dRtvjVTbrDoFlSaKIv1mJF+kCi/3wylTqy2srFezozIMetmlp5kSUiazZJKPnPveOc19MJhQ/MGv1GHFZI8ur1DuIae4FgGL6jUU7z/Y7zh4JHzPMJl2Wu2xXNsUeBAG+wEBj/yXHiJbBJuD5cn2spn7KgLF5C2/WFfTzG/zHNrTOjB/pLgDAypd+bvA9iwPUxaBgckajrDc3YNhlHJl83WlJLVM4a1V7nO5fl+hFUpJdaIbmmDpd7scMO1J8esE3frismQxsBPsiY0YE0CzGLv6amgwkvxrHIGAw0OqmbQG2cMb4mmhLrq2ocpcIMOtjcz6MJKv87qmA8rgO3h1auaiXnthi4KTGIQgrrvpZ93VcoraLnJyWd8nLmIHTBf9NosaJcGOWfC0N765SnE0PXIDTq44/sGLkP55nSoaG7Jo3Lo9P4uy9kl+pIp0pgaqGXcVwi0gUK0GIMQRDQQyhDJvK7/4u0S4RMipHcHvHVPp/jDvYuDSzdaE/t68iMxzsZ8zlIaBBFD3jVH+ZWj7DLxLJEaqeEU8o+I8WirCJeI86hIOaLYCyDo2Z6a3COHYJBskIRYoS9E0vF+fqdwVBA7le6T6I+2Jb0peXoKN9GyHK01VRAjCE8UbWIjKPJyZZSllSGWXKe8uVOYbPYjYo7aIqeGi1M6H6q0CBLpSAdElPNvJe8uEtBbdpf502wcH68mD3DndtPNA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR18MB5167.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(366004)(376002)(136003)(39860400002)(451199015)(316002)(4326008)(8676002)(64756008)(66556008)(66446008)(110136005)(66946007)(66476007)(54906003)(76116006)(26005)(71200400001)(478600001)(122000001)(38100700002)(53546011)(7696005)(2906002)(9686003)(6506007)(33656002)(41300700001)(83380400001)(8936002)(38070700005)(5660300002)(55016003)(52536014)(86362001)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?XPKyKNxFHUa/bt8I5IobHv5UBSet5dGueM1hHgpgcAERiskp7ekmger2SJb8?= =?us-ascii?Q?ywa7aIBKF6K+/+3Cf32CM1mlyS4LgWXdKS/TGe+DNlOEmPsl7qiqwYUiYSKa?= =?us-ascii?Q?SYNwr/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+kTQvUi773dobA9?= =?us-ascii?Q?zWTXC2HudbVxNviKJaoBQn7DCFbZJiGG8cclH/S9H2dE2JelKSekgFob1Eji?= =?us-ascii?Q?ttqSERWJO3oFkscflIm5s97+iuhj9cnn54USwCVgUCRSUJUFpZnyzv4DMJ1M?= =?us-ascii?Q?ryG0vaZu338Lk/mJoJaifq67MLeRzEx8omkbFtLA4XH2sHpvvh2tYFSzli2l?= =?us-ascii?Q?/2sjPivGZCrhAlKZoSN+CBtF44U5uEhDee2UE6YuzXxT/EmcXbJ0Mf+QYWtB?= =?us-ascii?Q?Fml63B27zzddnYJCQP3aNSf9xODX9wf3kBQQjbfEKNussjA/5Ml784Ip9Ylv?= =?us-ascii?Q?4nvN4KD1BUxeL/YzF6tcMwee7uU2CvNLpf7Qy01A9JlQGB3XH40HLMBgbiG1?= =?us-ascii?Q?NBhNyJi962oYRoZVdkUGQzwLZmGhdwciAIYay3/4Do4NxTrUiJuBOoNJly2g?= =?us-ascii?Q?LOl8lL9ctNtxe2HcRuwgMIrZdaVSwJl9K7QcxUoKHyJzUV8veLFYroDEVy4n?= =?us-ascii?Q?jmxQ+rAHeVE3VwmlBVb6oPZ242GRJiFG8Vx9SYxAIVkfs1i3VviP6fFp8onF?= =?us-ascii?Q?9mU9FGAoIQyATs15YCudoKiCUhgCIkGvs34Jk9u1?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR18MB5167.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed5bafa2-8df1-45e8-b72b-08daa76b804a X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2022 07:22:18.1597 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BlhaNwcuYgFM/d9cSeGJwy7W+N/k7hTkZHnC8a9ZSNlCliVJvxSBe/9SkpzjJjvQKb+riYFvxwmdEI51Lac3NI/SLFUZ6/9VZN0a+8KJ5Ss= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3653 X-Proofpoint-GUID: wVoqwd5YCvsvJbDK6ukNj5AX-3d_kh3h X-Proofpoint-ORIG-GUID: wVoqwd5YCvsvJbDK6ukNj5AX-3d_kh3h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-05_05,2022-10-05_01,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Ping.=20 > -----Original Message----- > From: Amit Prakash Shukla > Sent: Friday, September 2, 2022 8:36 PM > To: Maxime Coquelin ; Chenbo Xia > > Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran ; > stable@dpdk.org; Ruifeng.Wang@arm.com; Amit Prakash Shukla > > Subject: [PATCH v3] vhost: compilation fix for GCC-12 >=20 > GCC-12 complains about the possible use of un-initialized array. At compi= le > time it seems like it is not able to evaluate the size as it involves run= -time > variable and at compile time it seems like gcc assumes value of "size" va= riable > to be zero which makes gcc-12 to jump the while loop. > "size =3D pkt->pkt_len + sizeof(struct virtio_net_hdr_mrg_rxbuf);" >=20 > As part of the fix, "while (){}" is replaced by "do {} while()" which mak= e the > compiler to generate a code in which buf_vec will never be used un- > initialized. >=20 > ../lib/vhost/virtio_net.c:941:35: error: > 'buf_vec[0].buf_len' may be used uninitialized > [-Werror=3Dmaybe-uninitialized] > 941 | buf_len =3D buf_vec[vec_idx].buf_len; > | ~~~~~~~~~~~~~~~~^~~~~~~~ > ../lib/vhost/virtio_net.c: In function 'virtio_dev_rx_packed': > ../lib/vhost/virtio_net.c:1285:27: note: 'buf_vec' declared here > 1285 | struct buf_vector buf_vec[BUF_VECTOR_MAX]; > | ^~~~~~~ > cc1: all warnings being treated as errors >=20 > Fixes: 93520085efda ("vhost: add packed ring single enqueue") > Cc: stable@dpdk.org >=20 > Signed-off-by: Amit Prakash Shukla > --- > v2: > - Changes for code review suggestion >=20 > v3: > - Added a description >=20 > lib/vhost/virtio_net.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index > b3d954aab4..9b77d3d10f 100644 > --- a/lib/vhost/virtio_net.c > +++ b/lib/vhost/virtio_net.c > @@ -1069,7 +1069,7 @@ vhost_enqueue_single_packed(struct virtio_net > *dev, > else > max_tries =3D 1; >=20 > - while (size > 0) { > + do { > /* > * if we tried all available ring items, and still > * can't get enough buf, it means something abnormal @@ - > 1097,7 +1097,7 @@ vhost_enqueue_single_packed(struct virtio_net *dev, > avail_idx +=3D desc_count; > if (avail_idx >=3D vq->size) > avail_idx -=3D vq->size; > - } > + } while (size > 0); >=20 > if (mbuf_to_desc(dev, vq, pkt, buf_vec, nr_vec, num_buffers, false) > < 0) > return -1; > @@ -1574,7 +1574,7 @@ vhost_enqueue_async_packed(struct virtio_net > *dev, > else > max_tries =3D 1; >=20 > - while (size > 0) { > + do { > /* > * if we tried all available ring items, and still > * can't get enough buf, it means something abnormal @@ - > 1601,7 +1601,7 @@ vhost_enqueue_async_packed(struct virtio_net *dev, > avail_idx +=3D desc_count; > if (avail_idx >=3D vq->size) > avail_idx -=3D vq->size; > - } > + } while (size > 0); >=20 > if (unlikely(mbuf_to_desc(dev, vq, pkt, buf_vec, nr_vec, > *nr_buffers, true) < 0)) > return -1; > -- > 2.25.1