This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit d09372658f1e680a17c1274090694276e6795b29 Author: Yongrong Wang <[email protected]> AuthorDate: Tue Oct 21 11:14:55 2025 +0800 spinlock.h: fix zero Memset buffer size in spin_lock_init spinlock.h: fix the issue where the Memset buffer size was 0 during spin_lock_init Assisted-By: mimo-v2.6-pro Co-authored-by: ouyangxiangzhen <[email protected]> Signed-off-by: Yongrong Wang <[email protected]> Signed-off-by: ouyangxiangzhen <[email protected]> --- include/nuttx/spinlock.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index 695d98b8233..2bde1758417 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -122,7 +122,14 @@ void spinlock_switch_context(FAR struct tcb_s *from); ****************************************************************************/ #define spin_lock_init(l) \ - do { memset((FAR void *)l, 0, sizeof(*(l))); } while (0) + do \ + { \ + if (sizeof(*(l)) > 0) \ + { \ + memset((FAR void *)(l), 0, sizeof(*(l))); \ + } \ + } \ + while (0) /**************************************************************************** * Name: rspin_lock_init
