summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fifo.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-07-17 19:19:14 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:07 +0300
commit4077991c8536595b50b52bab739ef1e9ac6a72cf (patch)
tree5b4b6c1cea87f26aaff4491e1e40d96b8b99c270 /fs/bcachefs/fifo.h
parent97446a242a56f9350be7b8985ed933fe9118f41e (diff)
downloadlinux-4077991c8536595b50b52bab739ef1e9ac6a72cf.tar.xz
bcachefs: Fix a use after free in the journal code
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fifo.h')
-rw-r--r--fs/bcachefs/fifo.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/bcachefs/fifo.h b/fs/bcachefs/fifo.h
index bd1534ecadb6..00d245efe72a 100644
--- a/fs/bcachefs/fifo.h
+++ b/fs/bcachefs/fifo.h
@@ -109,17 +109,17 @@ do { \
#define fifo_peek(fifo) fifo_peek_front(fifo)
#define fifo_for_each_entry(_entry, _fifo, _iter) \
- for (((void) (&(_iter) == &(_fifo)->front)), \
- _iter = (_fifo)->front; \
+ for (typecheck(typeof((_fifo)->front), _iter), \
+ (_iter) = (_fifo)->front; \
((_iter != (_fifo)->back) && \
(_entry = (_fifo)->data[(_iter) & (_fifo)->mask], true)); \
- _iter++)
+ (_iter)++)
#define fifo_for_each_entry_ptr(_ptr, _fifo, _iter) \
- for (((void) (&(_iter) == &(_fifo)->front)), \
- _iter = (_fifo)->front; \
+ for (typecheck(typeof((_fifo)->front), _iter), \
+ (_iter) = (_fifo)->front; \
((_iter != (_fifo)->back) && \
(_ptr = &(_fifo)->data[(_iter) & (_fifo)->mask], true)); \
- _iter++)
+ (_iter)++)
#endif /* _BCACHEFS_FIFO_H */