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 41FFAA0542; Wed, 5 Oct 2022 16:56:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36D4540694; Wed, 5 Oct 2022 16:56:35 +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 D2C5740143 for ; Wed, 5 Oct 2022 16:56:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664981793; 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=VWOnYPv7XNGmpJRI1VCy1u+qzsNcN5J06mpBv5hlcoVR0MVSPlBgwMY0aiFOVnNNt1c5Dx oMxuTpmtQj0vLwdtkQPBluyiAGJzl/osQKwns7pa3Rk2Ex+UZH3URMgRILc0ExgaisW0iq iGZQkU7kRnP6CcYjmx46ViYljkp2i70= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-556-am682l3ePs-wZCFnHC7WWA-1; Wed, 05 Oct 2022 10:56:22 -0400 X-MC-Unique: am682l3ePs-wZCFnHC7WWA-1 Received: by mail-pl1-f197.google.com with SMTP id m3-20020a170902bb8300b0017f7e7e4385so1984589pls.20 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=vC4R3Ru0e7ggDgh6xypO7VLGAn4x96nKaMyYXcfywndI2PKDnFGUCsIWD72GBZReyM v/yuCAuV6msXc9Xpu/+2rWpa6YSTzWOjYjAt5p4Zmz4PETZZJKlWeWsLBg0U86jnHOp3 zV+a+VmYcvNaM6XvMqwvjMa+9dxQHPOx0NEEGMfnGO+fNkogYOAH8w4DiMI3gFPZID9C eCjzo0caMVAt0fleVKOrR+jx2gCMhlVc/5ig4s8RLpd3XJYBm6FX14oF+N6IWhP0pIgN KCX1YFcn1VpXnRO3VTlSLSnoxs4xGBSXiHm3Bq5n7v2Rdgs5EfVNMuFbaHGMnlF/MlV/ tZUQ== X-Gm-Message-State: ACrzQf3wLLjBHVFgyE5aZ78sbju0vZ25qzooSBJNHCzqCZ7C+cTOTXz6 vJ4u4ypkPR00nJSOXuaLWHN1vq8vIyubNdWsDgSyC0eqI0Y9q91BWZiaLhrqowwrxu+kZrnFK+W 8ccbuJpaf/FT8ilRV4WE= X-Received: by 2002:a63:5b58:0:b0:452:2ba4:f86b with SMTP id l24-20020a635b58000000b004522ba4f86bmr172186pgm.223.1664981781552; 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: 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 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