From 2b2549b57316033e544e3261334e3e20224563ce Mon Sep 17 00:00:00 2001 From: Mengsk Date: Wed, 30 Jun 2021 16:50:32 +0200 Subject: [PATCH] Fix fifo overflow correction. --- src/common/tusb_fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index 1eb886aa1..1229201b8 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -342,7 +342,7 @@ static uint16_t backward_pointer(tu_fifo_t* f, uint16_t p, uint16_t offset) // We limit the index space of p such that a correct wrap around happens // Check for a wrap around or if we are in unused index space - This has to be checked first!! // We are exploiting the wrap around to the correct index - if ((p < p - offset) || (p - offset > f->max_pointer_idx)) + if ((p < (uint16_t)(p - offset)) || ((uint16_t)(p - offset) > f->max_pointer_idx)) { p = (p - offset) - f->non_used_index_space; }