Skip to content

Commit 10a8857

Browse files
sweetteakdave
authored andcommitted
btrfs: fix compiler warning on SPARC/PA-RISC handling fscrypt_setup_filename
Commit 1ec4974 ("btrfs: turn on -Wmaybe-uninitialized") exposed that on SPARC and PA-RISC, 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 call site, and assert that no positive error codes are returned (which would have wider implications involving other users). Reported-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Sweet Tea Dorminy <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 1c3ab6d commit 10a8857

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/btrfs/inode.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5421,8 +5421,13 @@ static int btrfs_inode_by_name(struct btrfs_inode *dir, struct dentry *dentry,
54215421
return -ENOMEM;
54225422

54235423
ret = fscrypt_setup_filename(&dir->vfs_inode, &dentry->d_name, 1, &fname);
5424-
if (ret)
5424+
if (ret < 0)
54255425
goto out;
5426+
/*
5427+
* fscrypt_setup_filename() should never return a positive value, but
5428+
* gcc on sparc/parisc thinks it can, so assert that doesn't happen.
5429+
*/
5430+
ASSERT(ret == 0);
54265431

54275432
/* This needs to handle no-key deletions later on */
54285433

0 commit comments

Comments
 (0)