4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-18 12:03:57 +08:00

Merge pull request #1314 from enkiller/dev

[drivers]Fix put_force bug
This commit is contained in:
Bernard Xiong 2018-03-28 00:53:08 +08:00 committed by GitHub
commit c6a5a2a386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,8 +119,11 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
space_length = rt_ringbuffer_space_len(rb);
if (length > space_length)
if (length > rb->buffer_size)
{
ptr = &ptr[length - rb->buffer_size];
length = rb->buffer_size;
}
if (rb->buffer_size - rb->write_index > length)
{