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 38867A0542 for ; Wed, 5 Oct 2022 16:56:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1525040694; Wed, 5 Oct 2022 16:56:28 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 86FA740143 for ; Wed, 5 Oct 2022 16:56:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664981786; 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=cHq42zM/eZ2Ut1THhdb1mhD5yVOz1F55RYYNgbBivV0=; b=SbwFkVaQvCQQ6KtXN/Jv9UkaigFm/LzCZ6Ysgjoi5ZLhIQgP94LZl8Yep3XCjLVeuFNMX/ k8jB7aZcamI8X5or/LNEsBVC/tDeHOI/ceZg8PiPfdnmmqhFvQltd2+m3N2OTlhtmlPq4N jkBF4QgLQtsVNwWrn2mFaC7Ja1kTQCg= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-673-IVzIrqYuMdCTkhzq3Vfo9w-1; Wed, 05 Oct 2022 10:56:22 -0400 X-MC-Unique: IVzIrqYuMdCTkhzq3Vfo9w-1 Received: by mail-pl1-f198.google.com with SMTP id u6-20020a170902e5c600b0017e9ba1087aso7211406plf.12 for ; Wed, 05 Oct 2022 07:56:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=cHq42zM/eZ2Ut1THhdb1mhD5yVOz1F55RYYNgbBivV0=; b=k0SLmkROPaYC50ZNYdKYQCjmFixxXQbjr/5+ew3+BWNEly9m7nVJGobiZzD+50WYGB t8EblYo/0gA9tfxYM16zqkgzatnm7d8Md6GQ2Y/ANw0YRgp13o3fdg0QQvyi5Jn4GOBj ipw11ZWXcj/E1Q4ly4fnrE1jW3mbUPod5jEpUlJL1mw8rTLGgRUZD3+XsufSxeCRqTea aYcmU2GpBT81hxEYa/e576l1QavEAc+6cwaQ4mANVi+GKe0l2Oorb4yCu8YF7vh8NN/q mkOabb6yKnERlT1lDfgyybDW3WjVowQj30oiqrp/4VJMCzC0n4LgeQLh3Pzkx8tqUQhV mkCg== X-Gm-Message-State: ACrzQf1b34kUkUoWk3VzkVWPgDDqfxNQPPb2saY7VXQ/3I0tlgKd/hLS hd0qWZH13G5mdqZ+Zj1MxU3xiA1YF+SToaZK6tywFLz8koc/lDjVFZwaMP/iPbWOlvtNhBaqtTD Py66qxsRGbQTDuSGqtPS8KII= X-Received: by 2002:a63:5b58:0:b0:452:2ba4:f86b with SMTP id l24-20020a635b58000000b004522ba4f86bmr172190pgm.223.1664981781554; Wed, 05 Oct 2022 07:56:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Tk8XQXQqtDd17mOcC1Ld9UopA9RIGp2yRygTSmli2wzWYPfu6M8v71BRgOIv2PVwfhP6s5mLM7Erc8vMyOyc= X-Received: by 2002:a63:5b58:0:b0:452:2ba4:f86b with SMTP id l24-20020a635b58000000b004522ba4f86bmr172172pgm.223.1664981781296; Wed, 05 Oct 2022 07:56:21 -0700 (PDT) MIME-Version: 1.0 References: <20221005144859.70717-1-maxime.coquelin@redhat.com> In-Reply-To: <20221005144859.70717-1-maxime.coquelin@redhat.com> From: David Marchand Date: Wed, 5 Oct 2022 16:56:09 +0200 Message-ID: Subject: Re: [PATCH] vhost: fix compilation issue in async path To: Maxime Coquelin Cc: dev@dpdk.org, cheng1.jiang@intel.com, chenbo.xia@intel.com, zhoumin@loongson.cn, stable@dpdk.org, Thomas Monjalon X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Wed, Oct 5, 2022 at 4:49 PM Maxime Coquelin wrote: > > This patch fixes a compilation issue met with GCC on GCC 12 (it is worth detailing, since I and Thomas hit the same issue on some other cross compiling toolchains using GCC 12). > Loongarch64: LoongArch64 > > In function =E2=80=98mbuf_to_desc=E2=80=99, > inlined from =E2=80=98vhost_enqueue_async_packed=E2=80=99 at ../../..= /dpdk/lib/vhost/virtio_net.c:1822:6, > inlined from =E2=80=98virtio_dev_rx_async_packed=E2=80=99 at ../../..= /dpdk/lib/vhost/virtio_net.c:1836:6, > inlined from =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99 at .= ./../../dpdk/lib/vhost/virtio_net.c:1895:7: > ../../../dpdk/lib/vhost/virtio_net.c:1159:18: error: =E2=80=98buf_vec[0].= buf_addr=E2=80=99 may be used uninitialized [-Werror=3Dmaybe-uninitialized] > 1159 | buf_addr =3D buf_vec[vec_idx].buf_addr; > | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../../../dpdk/lib/vhost/virtio_net.c: In function =E2=80=98virtio_dev_rx_= async_submit_packed=E2=80=99: > ../../../dpdk/lib/vhost/virtio_net.c:1834:27: note: =E2=80=98buf_vec=E2= =80=99 declared here > 1834 | struct buf_vector buf_vec[BUF_VECTOR_MAX]; > | ^~~~~~~ > > It happens because the compiler assumes that 'size' > variable in vhost_enqueue_async_packed could wrap to 0 since > 'size' is uint32_t and pkt->pkt_len too. > > In practice, it would never happen since 'pkt->pkt_len' is > unlikely to be close to UINT32_MAX, but let's just change > 'size' to uint64_t to make the compiler happy without > having to add runtime checks. > > Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath") > Cc: stable@dpdk.org > > Signed-off-by: Maxime Coquelin Reviewed-by: David Marchand --=20 David Marchand