mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-18 19:50:57 +00:00
btrfs-progs: check, handle error in fix_key_order
In case the buffer is corrupted and the for loop does not happen, we'd return garbage. The caller retunrs -EIO in case of any corruption, use that value in fix_key_order. Resolves-coverity-id: 1246944 Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
de5c542275
commit
fd1e9ad6a8
@ -3468,7 +3468,7 @@ static int fix_key_order(struct btrfs_trans_handle *trans,
|
|||||||
struct btrfs_key k1, k2;
|
struct btrfs_key k1, k2;
|
||||||
int i;
|
int i;
|
||||||
int level = path->lowest_level;
|
int level = path->lowest_level;
|
||||||
int ret;
|
int ret = -EIO;
|
||||||
|
|
||||||
buf = path->nodes[level];
|
buf = path->nodes[level];
|
||||||
for (i = 0; i < btrfs_header_nritems(buf) - 1; i++) {
|
for (i = 0; i < btrfs_header_nritems(buf) - 1; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user