aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_buffers.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-12-23 12:47:54 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-12-23 12:47:54 +0000
commita71da8de12fd7e8f68cbaca3cd2d929107b7192a (patch)
treeb0a941e3a4697c0e739760207acc958f5331431e /os/hal/src/hal_buffers.c
parentc7530be768594bf30a93018caf178cef007aa14b (diff)
downloadChibiOS-a71da8de12fd7e8f68cbaca3cd2d929107b7192a.tar.gz
ChibiOS-a71da8de12fd7e8f68cbaca3cd2d929107b7192a.tar.bz2
ChibiOS-a71da8de12fd7e8f68cbaca3cd2d929107b7192a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8635 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src/hal_buffers.c')
-rw-r--r--os/hal/src/hal_buffers.c6
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");