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 50BF2A0032; Thu, 1 Sep 2022 10:49:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D740C41155; Thu, 1 Sep 2022 10:49:52 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5945A40395; Thu, 1 Sep 2022 10:49:51 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2815CueG006025; Thu, 1 Sep 2022 01:49:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=wMdLMWLPKX5fI7Kk3sgScrCKlJVQ5JIYcilbmIayNV8=; b=bvQR2mNFbN3vB8fl24eLS0O0L2/Jo8n3Bwh8+OhdVJIFtba3PD3Sz/e/xU9UpxfVH/GU Ff+OX+7AvfbIHGh3FLTQhuhyhoFIKPYTKwnNrCMv0/dO4w8LriKVIY+Gu1XpNIyOyjG8 w4aahMzRQpeVbakzWOqF06JZ0eNxvZOOmIc4HLOcM0XN1J/01DdjHO3Nh9IMQb56uX5P MN7PKYcF5rgJa0QRPOgAi2Xlc0CyfPUV7iKBjPrF2uTnaoAkstPZhplK9gH5XXRsD3xR N7rFapq39xvubGCo8dYj6+UJfjPthuMP65QzvPr/8zcCcZz4+I359mvVzNjsZ+ASPooK LA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ja3vemxna-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 01 Sep 2022 01:49:50 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 1 Sep 2022 01:49:48 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 1 Sep 2022 01:49:48 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id 9BD853F7050; Thu, 1 Sep 2022 01:49:46 -0700 (PDT) From: Amit Prakash Shukla To: Maxime Coquelin , Chenbo Xia CC: , , , "Amit Prakash Shukla" Subject: [PATCH] vhost: compilation fix for GCC-12 Date: Thu, 1 Sep 2022 14:19:43 +0530 Message-ID: <20220901084943.3075710-1-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 76NRKeebIeQ_f5pzjCOfgv82jxi0e3eU X-Proofpoint-GUID: 76NRKeebIeQ_f5pzjCOfgv82jxi0e3eU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-09-01_06,2022-08-31_03,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 ../lib/vhost/virtio_net.c:941:35: error: 'buf_vec[0].buf_len' may be used uninitialized [-Werror=maybe-uninitialized] 941 | buf_len = 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 Fixes: 93520085efda ("vhost: add packed ring single enqueue") Cc: stable@dpdk.org Signed-off-by: Amit Prakash Shukla --- lib/vhost/virtio_net.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index b3d954aab4..0220bc923c 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -1069,6 +1069,12 @@ vhost_enqueue_single_packed(struct virtio_net *dev, else max_tries = 1; + /* To avoid GCC-12 warning. + * GCC-12 is not evaluating sizeof at compile time. + */ + if (unlikely(size == 0)) + return -1; + while (size > 0) { /* * if we tried all available ring items, and still @@ -1574,6 +1580,12 @@ vhost_enqueue_async_packed(struct virtio_net *dev, else max_tries = 1; + /* To avoid GCC-12 warning. + * GCC-12 is not evaluating sizeof at compile time. + */ + if (unlikely(size == 0)) + return -1; + while (size > 0) { /* * if we tried all available ring items, and still -- 2.25.1