From 5cfd69775eb5460ef78bb5034a37eb0dc52ab65d Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 9 Sep 2023 20:10:11 -0400 Subject: 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 --- fs/bcachefs/bkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/bkey.c') 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; } -- cgit v1.2.3