summaryrefslogtreecommitdiff
path: root/fs/bcachefs/bkey.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-10 03:10:11 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:12 +0300
commit5cfd69775eb5460ef78bb5034a37eb0dc52ab65d (patch)
tree26a5e49f14d153acbf243df39a75e38ffdc9f3d6 /fs/bcachefs/bkey.c
parenta9a7bbab1469f0c427f90c309720c543e37ab110 (diff)
downloadlinux-5cfd69775eb5460ef78bb5034a37eb0dc52ab65d.tar.xz
bcachefs: Array bounds fixes
It's no longer legal to use a zero size array as a flexible array member - this causes UBSAN to complain. This patch switches our zero size arrays to normal flexible array members when possible, and inserts casts in other places (e.g. where we use the zero size array as a marker partway through an array). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bkey.c')
-rw-r--r--fs/bcachefs/bkey.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c
index 0a5bfe6e9a2d..a3abd9d2d176 100644
--- a/fs/bcachefs/bkey.c
+++ b/fs/bcachefs/bkey.c
@@ -127,7 +127,7 @@ static void pack_state_finish(struct pack_state *state,
struct bkey_packed *k)
{
EBUG_ON(state->p < k->_data);
- EBUG_ON(state->p >= k->_data + state->format->key_u64s);
+ EBUG_ON(state->p >= (u64 *) k->_data + state->format->key_u64s);
*state->p = state->w;
}