From: Stephen Hemminger <stephen@networkplumber•org>
To: netdev@vger•kernel.org
Cc: Stephen Hemminger <stephen@networkplumber•org>, shalomt@mellanox•com
Subject: [PATCH 1/5] devlink: fix uninitialized warning
Date: Sun, 29 Nov 2020 16:21:31 -0800 [thread overview]
Message-ID: <20201130002135.6537-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20201130002135.6537-1-stephen@networkplumber.org>
GCC-10 complains about uninitialized variable.
devlink.c: In function ‘cmd_dev’:
devlink.c:2803:12: warning: ‘val_u32’ may be used uninitialized in this function [-Wmaybe-uninitialized]
2803 | val_u16 = val_u32;
| ~~~~~~~~^~~~~~~~~
devlink.c:2747:11: note: ‘val_u32’ was declared here
2747 | uint32_t val_u32;
| ^~~~~~~
This is a false positive because it can't figure out the control flow
when the parse returns error.
Fixes: 2557dca2b028 ("devlink: Add string to uint{8,16,32} conversion for generic parameters")
Cc: shalomt@mellanox•com
Signed-off-by: Stephen Hemminger <stephen@networkplumber•org>
---
devlink/devlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 1ff865bc5c22..ca99732efd00 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2744,7 +2744,7 @@ static int cmd_dev_param_set(struct dl *dl)
struct param_ctx ctx = {};
struct nlmsghdr *nlh;
bool conv_exists;
- uint32_t val_u32;
+ uint32_t val_u32 = 0;
uint16_t val_u16;
uint8_t val_u8;
bool val_bool;
--
2.29.2
next prev parent reply other threads:[~2020-11-30 0:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 0:21 [PATCH 0/5] Fix compiler warnings from GCC-10 Stephen Hemminger
2020-11-30 0:21 ` Stephen Hemminger [this message]
2020-11-30 0:21 ` [PATCH 2/5] bridge: fix string length warning Stephen Hemminger
2020-11-30 0:21 ` [PATCH 3/5] tc: fix compiler warnings in ip6 pedit Stephen Hemminger
2020-11-30 23:10 ` Petr Machata
2020-11-30 0:21 ` [PATCH 4/5] misc: fix compiler warning in ifstat and nstat Stephen Hemminger
2020-11-30 9:18 ` David Laight
2020-11-30 17:31 ` Stephen Hemminger
2020-11-30 0:21 ` [PATCH 5/5] f_u32: fix compiler gcc-10 compiler warning Stephen Hemminger
2020-11-30 19:21 ` [PATCH 0/5] Fix compiler warnings from GCC-10 Jacob Keller
2020-12-03 16:40 ` patchwork-bot+netdevbpf
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=20201130002135.6537-2-stephen@networkplumber.org \
--to=stephen@networkplumber$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=shalomt@mellanox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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