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/10/13 06:06:03 UTC

(nuttx) 07/13: nuttx/note:fix runtime error.

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 04f3ff5942a548cde7036c1d7fa650fb50f941af
Author: cuiziwei <cu...@xiaomi.com>
AuthorDate: Thu Dec 21 20:17:33 2023 +0800

    nuttx/note:fix runtime error.
    
    note/note_driver.c:1405:11: runtime error: null pointer passed as argument 2, which is declared to never be null
        #0 0x33bf5cc in sched_note_event_ip note/note_driver.c:1405
        #1 0x33bfb57 in note_driver_instrument_enter note/note_initialize.c:55
        #2 0x347b084 in __cyg_profile_func_enter misc/lib_instrument.c:68
        #3 0x34179de in binder_initialize binder/binder.c:669
        #4 0x339a936 in drivers_initialize /home/cuiziwei/vela/happy/nuttx/drivers/drivers_initialize.c:242
        #5 0x335a179 in nx_start init/nx_start.c:632
        #6 0x32f755c in main sim/sim_head.c:180
        #7 0xf6821518  (/lib/i386-linux-gnu/libc.so.6+0x21518) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
        #8 0xf68215f2 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x215f2) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
        #9 0x32b401a in _start (/home/cuiziwei/vela/happy/nuttx/nuttx+0x32b401a) (BuildId: 33f8f7b361d44a008de87fea1bc970b22b48b700)
    
    Signed-off-by: cuiziwei <cu...@xiaomi.com>
---
 drivers/note/note_driver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c
index 0a20969e4f..8221e04327 100644
--- a/drivers/note/note_driver.c
+++ b/drivers/note/note_driver.c
@@ -1504,7 +1504,10 @@ void sched_note_event_ip(uint32_t tag, uintptr_t ip, uint8_t event,
 
           note_common(tcb, &note->nev_cmn, length, event);
           note->nev_ip = ip;
-          memcpy(note->nev_data, buf, length - SIZEOF_NOTE_EVENT(0));
+          if (buf != NULL)
+            {
+              memcpy(note->nev_data, buf, length - SIZEOF_NOTE_EVENT(0));
+            }
         }
 
       /* Add the note to circular buffer */