mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
trace_buffer: fix wrap condition
When committing a new entry, the buffer wrapped if the last entry fit perfectly into the buffer. Otherwise, the length field of the next entry was set to 0 to mark the new head. Yet, if there was still some padding but not enough to hold the length field of another entry, we ended up with a headless buffer. genodelabs/genode#4430
This commit is contained in:
parent
91b6032a71
commit
e35837e14b
@ -99,9 +99,9 @@ class Genode::Trace::Buffer
|
||||
*/
|
||||
size_t *old_head_len = &_head_entry()->len;
|
||||
|
||||
/* advance head offset, wrap when reaching buffer boundary */
|
||||
/* advance head offset, wrap when next entry does not fit into buffer */
|
||||
_head_offset += sizeof(_Entry) + len;
|
||||
if (_head_offset == _size)
|
||||
if (_head_offset + sizeof(_Entry) > _size)
|
||||
_buffer_wrapped();
|
||||
|
||||
/* mark entry next to new entry with len 0 */
|
||||
|
Loading…
Reference in New Issue
Block a user