From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [kdave-btrfs-devel:ext/dv/fscrypt 11/43] fs/btrfs/fscrypt.c:94 btrfs_fscrypt_set_context() warn: missing error code 'ret'
Date: Thu, 14 May 2026 11:09:41 +0800 [thread overview]
Message-ID: <202605141051.5L8RE7r0-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Omar Sandoval <osandov@osandov.com>
CC: David Sterba <dsterba@suse.com>
CC: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
CC: Josef Bacik <josef@toxicpanda.com>
CC: Daniel Vacek <neelx@suse.com>
tree: https://github.com/kdave/btrfs-devel.git ext/dv/fscrypt
head: 4c05f02641d57f578a685f7e8d27b9cb18d17cc7
commit: 4656a0f641c3d3c287316323b2bbdd023c8de0b2 [11/43] btrfs: add inode encryption contexts
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: x86_64-randconfig-161-20260514 (https://download.01.org/0day-ci/archive/20260514/202605141051.5L8RE7r0-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202605141051.5L8RE7r0-lkp@intel.com/
smatch warnings:
fs/btrfs/fscrypt.c:94 btrfs_fscrypt_set_context() warn: missing error code 'ret'
vim +/ret +94 fs/btrfs/fscrypt.c
4656a0f641c3d3c Omar Sandoval 2026-05-13 48
4656a0f641c3d3c Omar Sandoval 2026-05-13 49 static int btrfs_fscrypt_set_context(struct inode *inode, const void *ctx,
4656a0f641c3d3c Omar Sandoval 2026-05-13 50 size_t len, void *fs_data)
4656a0f641c3d3c Omar Sandoval 2026-05-13 51 {
4656a0f641c3d3c Omar Sandoval 2026-05-13 52 struct btrfs_trans_handle *trans = fs_data;
4656a0f641c3d3c Omar Sandoval 2026-05-13 53 struct btrfs_key key = {
4656a0f641c3d3c Omar Sandoval 2026-05-13 54 .objectid = btrfs_ino(BTRFS_I(inode)),
4656a0f641c3d3c Omar Sandoval 2026-05-13 55 .type = BTRFS_FSCRYPT_INODE_CTX_KEY,
4656a0f641c3d3c Omar Sandoval 2026-05-13 56 .offset = 0,
4656a0f641c3d3c Omar Sandoval 2026-05-13 57 };
4656a0f641c3d3c Omar Sandoval 2026-05-13 58 struct btrfs_path *path = NULL;
4656a0f641c3d3c Omar Sandoval 2026-05-13 59 struct extent_buffer *leaf;
4656a0f641c3d3c Omar Sandoval 2026-05-13 60 unsigned long ptr;
4656a0f641c3d3c Omar Sandoval 2026-05-13 61 int ret;
4656a0f641c3d3c Omar Sandoval 2026-05-13 62
4656a0f641c3d3c Omar Sandoval 2026-05-13 63 if (!trans)
4656a0f641c3d3c Omar Sandoval 2026-05-13 64 trans = btrfs_start_transaction(BTRFS_I(inode)->root, 2);
4656a0f641c3d3c Omar Sandoval 2026-05-13 65 if (IS_ERR(trans))
4656a0f641c3d3c Omar Sandoval 2026-05-13 66 return PTR_ERR(trans);
4656a0f641c3d3c Omar Sandoval 2026-05-13 67
4656a0f641c3d3c Omar Sandoval 2026-05-13 68 path = btrfs_alloc_path();
4656a0f641c3d3c Omar Sandoval 2026-05-13 69 if (!path) {
4656a0f641c3d3c Omar Sandoval 2026-05-13 70 ret = -ENOMEM;
4656a0f641c3d3c Omar Sandoval 2026-05-13 71 goto out_err;
4656a0f641c3d3c Omar Sandoval 2026-05-13 72 }
4656a0f641c3d3c Omar Sandoval 2026-05-13 73
4656a0f641c3d3c Omar Sandoval 2026-05-13 74 ret = btrfs_search_slot(trans, BTRFS_I(inode)->root, &key, path, 0, 1);
4656a0f641c3d3c Omar Sandoval 2026-05-13 75 if (ret < 0)
4656a0f641c3d3c Omar Sandoval 2026-05-13 76 goto out_err;
4656a0f641c3d3c Omar Sandoval 2026-05-13 77
4656a0f641c3d3c Omar Sandoval 2026-05-13 78 if (ret > 0) {
4656a0f641c3d3c Omar Sandoval 2026-05-13 79 btrfs_release_path(path);
4656a0f641c3d3c Omar Sandoval 2026-05-13 80 ret = btrfs_insert_empty_item(trans, BTRFS_I(inode)->root, path, &key, len);
4656a0f641c3d3c Omar Sandoval 2026-05-13 81 if (ret)
4656a0f641c3d3c Omar Sandoval 2026-05-13 82 goto out_err;
4656a0f641c3d3c Omar Sandoval 2026-05-13 83 }
4656a0f641c3d3c Omar Sandoval 2026-05-13 84
4656a0f641c3d3c Omar Sandoval 2026-05-13 85 leaf = path->nodes[0];
4656a0f641c3d3c Omar Sandoval 2026-05-13 86 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
4656a0f641c3d3c Omar Sandoval 2026-05-13 87
4656a0f641c3d3c Omar Sandoval 2026-05-13 88 len = min_t(size_t, len, btrfs_item_size(leaf, path->slots[0]));
4656a0f641c3d3c Omar Sandoval 2026-05-13 89 write_extent_buffer(leaf, ctx, ptr, len);
4656a0f641c3d3c Omar Sandoval 2026-05-13 90 btrfs_mark_buffer_dirty(trans, leaf);
4656a0f641c3d3c Omar Sandoval 2026-05-13 91 btrfs_release_path(path);
4656a0f641c3d3c Omar Sandoval 2026-05-13 92
4656a0f641c3d3c Omar Sandoval 2026-05-13 93 if (fs_data)
4656a0f641c3d3c Omar Sandoval 2026-05-13 @94 goto out_err;
4656a0f641c3d3c Omar Sandoval 2026-05-13 95
4656a0f641c3d3c Omar Sandoval 2026-05-13 96 BTRFS_I(inode)->flags |= BTRFS_INODE_ENCRYPT;
4656a0f641c3d3c Omar Sandoval 2026-05-13 97 btrfs_sync_inode_flags_to_i_flags(BTRFS_I(inode));
4656a0f641c3d3c Omar Sandoval 2026-05-13 98 inode_inc_iversion(inode);
4656a0f641c3d3c Omar Sandoval 2026-05-13 99 inode_set_ctime_current(inode);
4656a0f641c3d3c Omar Sandoval 2026-05-13 100 ret = btrfs_update_inode(trans, BTRFS_I(inode));
4656a0f641c3d3c Omar Sandoval 2026-05-13 101 if (ret)
4656a0f641c3d3c Omar Sandoval 2026-05-13 102 goto out_abort;
4656a0f641c3d3c Omar Sandoval 2026-05-13 103 btrfs_free_path(path);
4656a0f641c3d3c Omar Sandoval 2026-05-13 104 btrfs_end_transaction(trans);
4656a0f641c3d3c Omar Sandoval 2026-05-13 105 return 0;
4656a0f641c3d3c Omar Sandoval 2026-05-13 106 out_abort:
4656a0f641c3d3c Omar Sandoval 2026-05-13 107 btrfs_abort_transaction(trans, ret);
4656a0f641c3d3c Omar Sandoval 2026-05-13 108 out_err:
4656a0f641c3d3c Omar Sandoval 2026-05-13 109 if (!fs_data)
4656a0f641c3d3c Omar Sandoval 2026-05-13 110 btrfs_end_transaction(trans);
4656a0f641c3d3c Omar Sandoval 2026-05-13 111 btrfs_free_path(path);
4656a0f641c3d3c Omar Sandoval 2026-05-13 112 return ret;
4656a0f641c3d3c Omar Sandoval 2026-05-13 113 }
4656a0f641c3d3c Omar Sandoval 2026-05-13 114
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-05-14 3:10 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=202605141051.5L8RE7r0-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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 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.