mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] fs: avoid uninitialized var warning
Date: Mon,  7 Nov 2022 11:28:00 +0100	[thread overview]
Message-ID: <20221107102800.3669168-1-s.hauer@pengutronix.de> (raw)

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




                 reply	other threads:[~2022-11-07 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221107102800.3669168-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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