You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/28 03:08:46 UTC
(nuttx) 01/04: noteram:overflow may discard all the trace message
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 98482d429b14d73952ff8cd31dc53ab07416c322
Author: dulibo1 <du...@xiaomi.com>
AuthorDate: Wed Mar 20 14:31:57 2024 +0800
noteram:overflow may discard all the trace message
noteram_add may cause head = tail when remain == NOTE_ALIGN(notelen)
log:
nsh_main-14 [0] 2.132127493: tracing_mark_write: B|14|trace dump -c
nsh_main-14 [0] 2.143322780: tracing_mark_write: E|14|trace dump -c
nsh_main-14 [0] 2.513023895: tracing_mark_write: B|14|trace dump -c
nsh_main-14 [0] 2.524060048: tracing_mark_write: E|14|trace dump -c
nsh_main-14 [0] 2.897055341: tracing_mark_write: B|14|trace dump -c
ap> trace dump -c
nsh_main-14 [0] 3.270037241: tracing_mark_write: B|14|trace dump -c
ap> trace dump -c
Signed-off-by: dulibo1 <du...@xiaomi.com>
---
drivers/note/noteram_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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;