All of
 help / color / mirror / Atom feed
From: Sweet Tea Dorminy <>
To: Chris Mason <>, Josef Bacik <>,
	David Sterba <>,
Cc: Sweet Tea Dorminy <>,
	Guenter Roeck <>
Subject: [PATCH] btrfs: fix compilation error on sparc/parisc
Date: Wed,  8 Mar 2023 10:58:36 -0500	[thread overview]
Message-ID: <> (raw)

Commit 1ec49744ba83 ("btrfs: turn on -Wmaybe-uninitialized") exposed
that on sparc and parisc, gcc is unaware that fscrypt_setup_filename()
only returns negative error values or 0. This ultimately results in a
maybe-uninitialized warning in btrfs_lookup_dentry().

Change to only return negative error values or 0 from
fscrypt_setup_filename() at the relevant callsite, and assert that no
positive error codes are returned (which would have wider implications
involving other users).

Reported-by: Guenter Roeck <>
Signed-off-by: Sweet Tea Dorminy <>
 fs/btrfs/inode.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 45102785c723..50178609f241 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5409,8 +5409,13 @@ static int btrfs_inode_by_name(struct btrfs_inode *dir, struct dentry *dentry,
 		return -ENOMEM;
 	ret = fscrypt_setup_filename(&dir->vfs_inode, &dentry->d_name, 1, &fname);
-	if (ret)
+	if (ret < 0)
 		goto out;
+	/*
+	 * fscrypt_setup_filename() should never return a positive value, but
+	 * gcc on sparc/parisc thinks it can, so assert that doesn't happen.
+	 */
+	ASSERT(ret == 0);
 	/* This needs to handle no-key deletions later on */

             reply	other threads:[~2023-03-08 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 15:58 Sweet Tea Dorminy [this message]
2023-03-08 17:12 ` [PATCH] btrfs: fix compilation error on sparc/parisc Guenter Roeck
2023-03-09 17:43 ` David Sterba

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.