* [PATCH] fs: avoid uninitialized var warning
@ 2022-11-07 10:28 Sascha Hauer
0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2022-11-07 10:28 UTC (permalink / raw)
To: Barebox List
With gcc-12.2.1-clang-15.0.2-glibc-2.36-binutils-2.39-kernel-6.0.5-sanitized
we get a warning about path.dentry being used uninitialized:
fs/fs.c:1978:43: warning: 'path.dentry' may be used uninitialized -Wmaybe-uninitialized]
I can't see how this can really happen. gcc seems to think that this
sequence used in lookup_fast() can result in returning 0:
if (IS_ERR(dentry))
return PTR_ERR(dentry);
This shouldn't happen. Silence the warning by initializing 'path'.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fs.c b/fs/fs.c
index 8f21420494..b5a0912405 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1956,7 +1956,7 @@ static inline int step_into(struct nameidata *nd, struct path *path,
static int walk_component(struct nameidata *nd, int flags)
{
- struct path path;
+ struct path path = {};
int err;
/*
--
2.30.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-07 10:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 10:28 [PATCH] fs: avoid uninitialized var warning Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox