diff options
| author | Yue Haibing <yuehaibing@huawei.com> | 2024-10-22 17:52:08 +0800 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2024-10-22 16:10:55 +0200 |
| commit | 75f49c3dc7b7423d3734f2e4dabe3dac8d064338 (patch) | |
| tree | 24ab82f1be70221420e126678af657f937d02b58 /fs/btrfs/dir-item.c | |
| parent | 3c36a72c1d27de6618c1c480c793d9924640f5bb (diff) | |
| download | linux-75f49c3dc7b7423d3734f2e4dabe3dac8d064338.tar.gz linux-75f49c3dc7b7423d3734f2e4dabe3dac8d064338.tar.bz2 linux-75f49c3dc7b7423d3734f2e4dabe3dac8d064338.zip | |
btrfs: fix passing 0 to ERR_PTR in btrfs_search_dir_index_item()
The ret may be zero in btrfs_search_dir_index_item() and should not
passed to ERR_PTR(). Now btrfs_unlink_subvol() is the only caller to
this, reconstructed it to check ERR_PTR(-ENOENT) while ret >= 0.
This fixes smatch warnings:
fs/btrfs/dir-item.c:353
btrfs_search_dir_index_item() warn: passing zero to 'ERR_PTR'
Fixes: 9dcbe16fccbb ("btrfs: use btrfs_for_each_slot in btrfs_search_dir_index_item")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dir-item.c')
| -rw-r--r-- | fs/btrfs/dir-item.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index 001c0c2f872c..1e8cd7c9472e 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c @@ -347,8 +347,8 @@ btrfs_search_dir_index_item(struct btrfs_root *root, struct btrfs_path *path, return di; } /* Adjust return code if the key was not found in the next leaf. */ - if (ret > 0) - ret = 0; + if (ret >= 0) + ret = -ENOENT; return ERR_PTR(ret); } |
