From d2cd2e05bb6e7e92fc6fadaa318ec37c8b3e062b Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 6 Aug 2016 02:45:17 +0200 Subject: lib: shm_du_map: Fix wrong padding Padding was miscalculated, causing lockups in the fast path. --- src/lib/shm_du_map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 8d197232..3e2c99d4 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -332,7 +332,7 @@ void * shm_du_map_sanitize(void * o) } if (ret == ETIMEDOUT) { - LOG_DBGF("SDU timed out."); + LOG_DBGF("SDU timed out (dst: %d).", api); clean_sdus(dum, api, false); } } @@ -439,7 +439,7 @@ ssize_t shm_du_map_write(struct shm_du_map * dum, ++blocks; } - if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE - 1) + if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE) padblocks = SHM_BUFFER_SIZE - *dum->ptr_head; if (!shm_map_free(dum, (blocks + padblocks))) { @@ -528,7 +528,7 @@ ssize_t shm_du_map_write_b(struct shm_du_map * dum, ++blocks; } - if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE - 1) + if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE) padblocks = SHM_BUFFER_SIZE - *dum->ptr_head; while (!shm_map_free(dum, (blocks + padblocks))) { -- cgit v1.2.3