patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ruifeng Wang <Ruifeng.Wang@arm.com>
To: Amit Prakash Shukla <amitprakashs@marvell.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"jerinj@marvell.com" <jerinj@marvell.com>,
	 "stable@dpdk.org" <stable@dpdk.org>, nd <nd@arm.com>
Subject: RE: [PATCH] vhost: compilation fix for GCC-12
Date: Fri, 2 Sep 2022 07:23:39 +0000	[thread overview]
Message-ID: <AS8PR08MB7080E0056C9826A40F7E1EFC9E7A9@AS8PR08MB7080.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20220901084943.3075710-1-amitprakashs@marvell.com>

> -----Original Message-----
> From: Amit Prakash Shukla <amitprakashs@marvell.com>
> Sent: Thursday, September 1, 2022 4:50 PM
> To: Maxime Coquelin <maxime.coquelin@redhat.com>; Chenbo Xia <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; stable@dpdk.org; Amit Prakash Shukla
> <amitprakashs@marvell.com>
> Subject: [PATCH] vhost: compilation fix for GCC-12
> 
> ../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 <amitprakashs@marvell.com>
> ---
>  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.
Is this a compiler behavior change against previous versions?
I tried to find some clue from gcc-12 doc but got nothing. Can you point me to any material?

> +	 */
> +	if (unlikely(size == 0))
> +		return -1;
> +
>  	while (size > 0) {
Change 'while(){}' to 'do{}while()' can be a simpler solution. What do you think?

Thanks.

>  		/*
>  		 * 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


  reply	other threads:[~2022-09-02  7:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01  8:49 Amit Prakash Shukla
2022-09-02  7:23 ` Ruifeng Wang [this message]
2022-09-02 11:57   ` Amit Prakash Shukla
2022-09-02 12:41 ` [PATCH v2] " Amit Prakash Shukla
2022-09-02 12:56   ` Bagas Sanjaya
2022-09-02 15:11     ` [EXT] " Amit Prakash Shukla
2022-09-02 15:06 ` [PATCH v3] " Amit Prakash Shukla
2022-10-06  7:22   ` Amit Prakash Shukla
2022-10-06  7:24     ` Maxime Coquelin
2022-10-06  8:05       ` [EXT] " Amit Prakash Shukla
2022-10-06 12:35         ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8PR08MB7080E0056C9826A40F7E1EFC9E7A9@AS8PR08MB7080.eurprd08.prod.outlook.com \
    --to=ruifeng.wang@arm.com \
    --cc=amitprakashs@marvell.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nd@arm.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).