diff --git a/drivers/note/noteram_driver.c b/drivers/note/noteram_driver.c index 22aa6ac6d3..f6db8ee064 100644 --- a/drivers/note/noteram_driver.c +++ b/drivers/note/noteram_driver.c @@ -567,7 +567,7 @@ static void noteram_add(FAR struct note_driver_s *driver, DEBUGASSERT(note != NULL && notelen < drv->ni_bufsize); remain = drv->ni_bufsize - noteram_length(drv); - if (remain < notelen) + if (remain <= NOTE_ALIGN(notelen)) { if (drv->ni_overwrite == NOTERAM_MODE_OVERWRITE_DISABLE) { @@ -586,7 +586,7 @@ static void noteram_add(FAR struct note_driver_s *driver, noteram_remove(drv); remain = drv->ni_bufsize - noteram_length(drv); } - while (remain < notelen); + while (remain <= NOTE_ALIGN(notelen)); } head = drv->ni_head;