diff options
Diffstat (limited to 'os/hal/src/hal_buffers.c')
-rw-r--r-- | os/hal/src/hal_buffers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c index 2f47cd649..7c309305f 100644 --- a/os/hal/src/hal_buffers.c +++ b/os/hal/src/hal_buffers.c @@ -135,7 +135,7 @@ void ibqPostFullBufferI(input_buffers_queue_t *ibqp, size_t size) { osalDbgCheckClassI();
- osalDbgCheck(size > 0);
+ osalDbgCheck((size > 0) && (size <= ibqp->bsize - sizeof (size_t)));
osalDbgAssert(!ibqIsFullI(ibqp), "buffers queue full");
/* Writing size field in the buffer.*/
@@ -510,12 +510,14 @@ msg_t obqGetEmptyBufferTimeout(output_buffers_queue_t *obqp, * @note The object callback is called after releasing the buffer.
*
* @param[in] obqp pointer to the @p output_buffers_queue_t object
- * @param[in] size used size of the buffer
+ * @param[in] size used size of the buffer, cannot be zero
*
* @api
*/
void obqPostFullBuffer(output_buffers_queue_t *obqp, size_t size) {
+ osalDbgCheck((size > 0) && (size <= obqp->bsize - sizeof (size_t)));
+
osalSysLock();
osalDbgAssert(!obqIsFullI(obqp), "buffers queue full");
|