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 ABD79A0542; Wed, 5 Oct 2022 16:51:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B27740694; Wed, 5 Oct 2022 16:51:46 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 818E540143 for ; Wed, 5 Oct 2022 16:51:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664981504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gndvcvPpQzRl5eRUuuGcVZVuZpclpzkzZ9BRSifh4DY=; b=IoOJIFuS7ia9AQ7wFOMdINb8RecKnnFnwKw04/MDqUuFgKeq9vuEJudXWirQ8PgxhOkAuU 9dhxBRebyc9+ZZworYOvw8nipwZuHYPGb8Bd542EE3uzdHGUKRMjf8SvtimozV6rTgv3RZ 2GPT+wuWDaq4TFBcs7DSh44LHqRMwbA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-380-OuMP64drMxe2V53ZzwNr_g-1; Wed, 05 Oct 2022 10:51:41 -0400 X-MC-Unique: OuMP64drMxe2V53ZzwNr_g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF8651C09CA5; Wed, 5 Oct 2022 14:51:40 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8B13111144F; Wed, 5 Oct 2022 14:51:37 +0000 (UTC) Message-ID: Date: Wed, 5 Oct 2022 16:51:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v2] vhost: fix build To: zhoumin , "Xia, Chenbo" , "david.marchand@redhat.com" Cc: "dev@dpdk.org" , "maobibo@loongson.cn" References: <20220829082915.1056865-1-zhoumin@loongson.cn> <7352946c-b313-d5ea-e2a0-6f761997594d@loongson.cn> From: Maxime Coquelin In-Reply-To: <7352946c-b313-d5ea-e2a0-6f761997594d@loongson.cn> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 Hi Min, On 9/26/22 05:25, zhoumin wrote: > Hi Chenbo, > > > On Mon, 26 Sep 2022, 10:57, Xia, Chenbo wrote: >> Hi Min, >> >>> -----Original Message----- >>> From: Min Zhou >>> Sent: Monday, August 29, 2022 4:29 PM >>> To: david.marchand@redhat.com; maxime.coquelin@redhat.com; Xia, Chenbo >>> ; zhoumin@loongson.cn >>> Cc: dev@dpdk.org; maobibo@loongson.cn >>> Subject: [PATCH v2] vhost: fix build >>> >>> On CentOS 8 or Debian 10.4 systems using gcc 12.1 to cross >>> compile DPDK, gcc shows a following warning which will cause >>> build to fail when build is run with -werror: >>> >>> In function 'mbuf_to_desc', >>>      inlined from 'vhost_enqueue_async_packed' >>> at ../lib/vhost/virtio_net.c:1826:6, >>>      inlined from 'virtio_dev_rx_async_packed' >>> at ../lib/vhost/virtio_net.c:1840:6, >>>      inlined from 'virtio_dev_rx_async_submit_packed.constprop' >>> at ../lib/vhost/virtio_net.c:1900:7: >>> ../lib/vhost/virtio_net.c:1161:35: error: 'buf_vec[0].buf_len' may be >>> used >>> uninitialized [-Werror=maybe-uninitialized] >>>   1161 |         buf_len = buf_vec[vec_idx].buf_len; >>>        |                   ~~~~~~~~~~~~~~~~^~~~~~~~ >>> ../lib/vhost/virtio_net.c: In function >>> 'virtio_dev_rx_async_submit_packed.constprop': >>> ../lib/vhost/virtio_net.c:1838:27: note: 'buf_vec' declared here >>>   1838 |         struct buf_vector buf_vec[BUF_VECTOR_MAX]; >>>        |                           ^~~~~~~ >>> cc1: all warnings being treated as errors >>> >>> Actually, there are eight places to see the same codes in the file >>> lib/vhost/virtio_net.c, and all these `buf_vec` arraies are >>> initialized by sub-function calls under various conditions. >>> >>> Although It's hard to understand why gcc just emits warning at one >>> of the eight places, adding validity checks for array length is >>> reasonable and can also fix the warning. >>> >>> Signed-off-by: David Marchand >>> Signed-off-by: Min Zhou >>> --- >>>   lib/vhost/virtio_net.c | 5 ++++- >>>   1 file changed, 4 insertions(+), 1 deletion(-) >> Just want you to know that your patch is still pending because by >> accident >> your fix is almost the same as a previous patch that fixes a real >> issue but >> that patch is still in progress: >> >> http://patchwork.dpdk.org/project/dpdk/patch/20220802004938.23670-2-cfontana@suse.de/ >> >> Thanks, >> Chenbo > > Thanks for your helpful reply. > I think I can drop this patch if the patch you mentioned above could be > accepted. I just sent another patch that fixes your build issue without having to add runtime checks: http://patches.dpdk.org/project/dpdk/patch/20221005144859.70717-1-maxime.coquelin@redhat.com/ Thanks, Maxime