From 43b7d960af5616b5e2bc65b67fc6e21e76d6155c Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Thu, 22 Jul 2021 13:29:11 +0200 Subject: [PATCH] netdev-dummy: Silence the 'may be uninitialized' warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Ilya Maximets --- 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);