diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/dev.c | 1 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 8 | ||||
-rw-r--r-- | fs/btrfs/kernel-shared/btrfs_tree.h | 5 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 3 |
6 files changed, 7 insertions, 13 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 59439552a45..b7be09d5df8 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -461,7 +461,6 @@ static inline u8 *btrfs_dev_extent_chunk_tree_uuid(struct btrfs_dev_extent *dev) return (u8 *)((unsigned long)dev + ptr); } - /* struct btrfs_extent_item */ BTRFS_SETGET_FUNCS(extent_refs, struct btrfs_extent_item, refs, 64); BTRFS_SETGET_STACK_FUNCS(stack_extent_refs, struct btrfs_extent_item, refs, 64); diff --git a/fs/btrfs/dev.c b/fs/btrfs/dev.c index cb3b9713a5f..e27a032c9f6 100644 --- a/fs/btrfs/dev.c +++ b/fs/btrfs/dev.c @@ -5,7 +5,6 @@ * 2017 Marek BehĂșn, CZ.NIC, kabel@kernel.org */ -#include <common.h> #include <blk.h> #include <compiler.h> #include <fs_internal.h> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7eaa7e94960..34d9d535121 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0+ -#include <common.h> #include <fs_internal.h> #include <log.h> #include <uuid.h> @@ -70,7 +69,6 @@ static int check_tree_block(struct btrfs_fs_info *fs_info, btrfs_header_fsid(), BTRFS_FSID_SIZE); - if (fsid_match) { ret = 0; break; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4691612eda3..3998ffc2c81 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -640,7 +640,11 @@ static int read_and_truncate_page(struct btrfs_path *path, extent_type = btrfs_file_extent_type(leaf, fi); if (extent_type == BTRFS_FILE_EXTENT_INLINE) { ret = btrfs_read_extent_inline(path, fi, buf); - memcpy(dest, buf + page_off, min(page_len, ret)); + if (ret < 0) { + free(buf); + return ret; + } + memcpy(dest, buf + page_off, min3(page_len, ret, len)); free(buf); return len; } @@ -652,7 +656,7 @@ static int read_and_truncate_page(struct btrfs_path *path, free(buf); return ret; } - memcpy(dest, buf + page_off, page_len); + memcpy(dest, buf + page_off, min(page_len, len)); free(buf); return len; } diff --git a/fs/btrfs/kernel-shared/btrfs_tree.h b/fs/btrfs/kernel-shared/btrfs_tree.h index d8eff0b9122..f9dc005c50b 100644 --- a/fs/btrfs/kernel-shared/btrfs_tree.h +++ b/fs/btrfs/kernel-shared/btrfs_tree.h @@ -115,7 +115,6 @@ #define BTRFS_LAST_FREE_OBJECTID -256ULL #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL - /* * The device items go into the chunk tree. * @@ -333,7 +332,6 @@ */ #define BTRFS_STRING_ITEM_KEY 253 - /* 32 bytes in various csum fields */ #define BTRFS_CSUM_SIZE 32 @@ -508,7 +506,6 @@ struct btrfs_free_space_header { #define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35) #define BTRFS_SUPER_FLAG_CHANGING_FSID_V2 (1ULL << 36) - /* * Items in the extent tree are used to record the objectid of the * owner of the block and the number of references. @@ -523,7 +520,6 @@ struct btrfs_extent_item_v0 { __le32 refs; } __attribute__ ((__packed__)); - #define BTRFS_EXTENT_FLAG_DATA (1ULL << 0) #define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1) @@ -565,7 +561,6 @@ struct btrfs_extent_ref_v0 { __le32 count; } __attribute__ ((__packed__)); - /* Dev extents record used space on individual devices. * * The owner field points back to the chunk allocation mapping tree that diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 7d4095d9ca8..5726981b19c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ #include <stdlib.h> -#include <common.h> +#include <errno.h> #include <fs_internal.h> #include "ctree.h" #include "disk-io.h" @@ -255,7 +255,6 @@ static int device_list_add(struct btrfs_super_block *disk_super, } } - if (found_transid > fs_devices->latest_trans) { fs_devices->latest_devid = devid; fs_devices->latest_trans = found_transid; |