From 2b4d2cd4a3d6f3d21b80a41b69e156f5d13ef1cf Mon Sep 17 00:00:00 2001 From: "Nakamura, Yuuichi" Date: Wed, 22 Jul 2020 22:40:17 +0900 Subject: [PATCH] Fix note structure members types --- include/nuttx/sched_note.h | 6 +++--- sched/sched/sched_note.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h index eaa10a4cb7..1052a08aca 100644 --- a/include/nuttx/sched_note.h +++ b/include/nuttx/sched_note.h @@ -239,14 +239,14 @@ struct note_spinlock_s struct note_syscall_enter_s { struct note_common_s nsc_cmn; /* Common note parameters */ - int nsc_nr; /* System call number */ + uint8_t nsc_nr; /* System call number */ }; struct note_syscall_leave_s { struct note_common_s nsc_cmn; /* Common note parameters */ uintptr_t nsc_result; /* Result of the system call */ - int nsc_nr; /* System call number */ + uint8_t nsc_nr; /* System call number */ }; #endif /* CONFIG_SCHED_INSTRUMENTATION_SYSCALL */ @@ -256,7 +256,7 @@ struct note_syscall_leave_s struct note_irqhandler_s { struct note_common_s nih_cmn; /* Common note parameters */ - int nih_irq; /* IRQ number */ + uint8_t nih_irq; /* IRQ number */ }; #endif /* CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER */ #endif /* CONFIG_SCHED_INSTRUMENTATION_BUFFER */ diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c index 3d9748d60e..e13a85b2e8 100644 --- a/sched/sched/sched_note.c +++ b/sched/sched/sched_note.c @@ -585,6 +585,7 @@ void sched_note_syscall_enter(int nr, int argc, ...) note_common(tcb, ¬e.nsc_cmn, sizeof(struct note_syscall_enter_s), NOTE_SYSCALL_ENTER); + DEBUGASSERT(nr <= UCHAR_MAX); note.nsc_nr = nr; /* Add the note to circular buffer */ @@ -602,6 +603,7 @@ void sched_note_syscall_leave(int nr, uintptr_t result) note_common(tcb, ¬e.nsc_cmn, sizeof(struct note_syscall_leave_s), NOTE_SYSCALL_LEAVE); note.nsc_result = result; + DEBUGASSERT(nr <= UCHAR_MAX); note.nsc_nr = nr; /* Add the note to circular buffer */ @@ -620,6 +622,7 @@ void sched_note_irqhandler(int irq, FAR void *handler, bool enter) note_common(tcb, ¬e.nih_cmn, sizeof(struct note_irqhandler_s), enter ? NOTE_IRQ_ENTER : NOTE_IRQ_LEAVE); + DEBUGASSERT(irq <= UCHAR_MAX); note.nih_irq = irq; /* Add the note to circular buffer */