2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

netdev-dummy: Silence the 'may be uninitialized' warning.

GCC 11 with -O1 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.

Acked-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Ilya Maximets 2021-07-22 13:29:11 +02:00
parent f05d6d623e
commit 43b7d960af

View File

@ -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);