[ovs-dev] [PATCH] netdev-dummy: Silence the 'may be uninitialized' warning.
Roi Dayan
roid at nvidia.com
Thu Jul 22 18:24:10 UTC 2021
On 2021-07-22 2:33 PM, Ilya Maximets wrote:
> GCC 11 on Feodra 34 emits a false-positive warning like this:
>
> lib/netdev-dummy.c: In function ‘dummy_packet_stream_run’:
> lib/netdev-dummy.c:284:16: error: ‘n’ may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> 284 | if (retval == n && dp_packet_size(&s->rxbuf) > 2) {
> | ^
>
> This breaks the build with --enable-Werror. Initializing 'n' to
> avoid the warning.
>
> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
> ---
> lib/netdev-dummy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
> index 71df29184..1f386b81b 100644
> --- a/lib/netdev-dummy.c
> +++ b/lib/netdev-dummy.c
> @@ -233,7 +233,7 @@ static int
> dummy_packet_stream_run(struct netdev_dummy *dev, struct dummy_packet_stream *s)
> {
> int error = 0;
> - size_t n;
> + size_t n = 0;
>
> stream_run(s->stream);
>
>
Hi Ilya,
I'm actually compiling now ovs on FC34 with --enable-Werror and I'm
not hitting a compilation issue.
Maybe there is something else related to the compilation issue?
gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
Thanks,
Roi
More information about the dev
mailing list