diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-06-17 10:06:03 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-06-19 18:27:24 -0400 |
| commit | cff07e2739d81cf33eb2a378a6136eced852b8cb (patch) | |
| tree | 16d13ed597b1558a6eeb6bd686acda0199d7f190 /fs/bcachefs/bcachefs_format.h | |
| parent | 1ba44217f8258f92c56644ca4fad4462f1941e33 (diff) | |
bcachefs: Guard against overflowing LRU_TIME_BITS
LRUs only have 48 bits for the time field (i.e. LRU order); thus we need
overflow checks and guards.
Reported-by: syzbot+df3bf3f088dcaa728857@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs_format.h')
| -rw-r--r-- | fs/bcachefs/bcachefs_format.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 5d3c5b5e34af..4b98fed1ee9a 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -476,6 +476,9 @@ struct bch_lru { #define LRU_ID_STRIPES (1U << 16) +#define LRU_TIME_BITS 48 +#define LRU_TIME_MAX ((1ULL << LRU_TIME_BITS) - 1) + /* Optional/variable size superblock sections: */ struct bch_sb_field { |
