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 94D4FA00C2; Thu, 6 Oct 2022 05:56:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39E0A40A82; Thu, 6 Oct 2022 05:56:58 +0200 (CEST) Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by mails.dpdk.org (Postfix) with ESMTP id 1517040697 for ; Thu, 6 Oct 2022 05:56:55 +0200 (CEST) Received: from [192.168.0.103] (unknown [114.241.48.130]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axy2r8UT5jU9wmAA--.8148S3; Thu, 06 Oct 2022 11:56:45 +0800 (CST) Message-ID: <37ac890a-2f2c-43b5-59a8-34620f9ea7aa@loongson.cn> Date: Thu, 6 Oct 2022 11:56:44 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v2] vhost: fix build To: Maxime Coquelin , "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: zhoumin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Axy2r8UT5jU9wmAA--.8148S3 X-Coremail-Antispam: 1UD129KBjvJXoWxWFyDKryfuw18Aw4xJFyrJFb_yoW5uw1UpF 95J3Z8CFy5KryIkan2q3WIyry0yw1kG3sFqr43XF1xAFWDtr9IqryIgr1jgrW7Jr4Fk3WU Xr18Ja4xZ3WUuFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r1j 6r4UM28EF7xvwVC2z280aVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8JV W8Jr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCY02Avz4vE14v_Gr4l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr 1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE 14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7 IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0x ZFpf9x0JU2FALUUUUU= X-CM-SenderInfo: 52kr3ztlq6z05rqj20fqof0/ 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, Maxime, Thanks a lot for your kind reply. This patch is very useful and relieves the concerns in my heart. On Wed, Oct 5, 2022 at 22:51, Maxime Coquelin wrote: > 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/ > > OK, thanks. I have read the whole thread, which is a good job. I'd like thank you all for your hard work. > Thanks, > Maxime >