mirror of
https://github.com/apache/nuttx.git
synced 2026-09-04 16:13:00 +00:00
fix build warning to [-Wstringop-overread].
note/note_driver.c:639:21: warning: 'strlen' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
639 | namelen = strlen(tcb->name);
| ^~~~~~~~~~~~~~~~~
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This commit is contained in:
parent
04f3ff5942
commit
4b318cb2cb
1 changed files with 5 additions and 2 deletions
|
|
@ -642,7 +642,7 @@ void sched_note_start(FAR struct tcb_s *tcb)
|
|||
bool formatted = false;
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
int namelen;
|
||||
int namelen = 0;
|
||||
#endif
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
|
|
@ -671,7 +671,10 @@ void sched_note_start(FAR struct tcb_s *tcb)
|
|||
*/
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
namelen = strlen(tcb->name);
|
||||
if (tcb->name[0] != '\0')
|
||||
{
|
||||
namelen = strlen(tcb->name);
|
||||
}
|
||||
|
||||
DEBUGASSERT(namelen <= CONFIG_TASK_NAME_SIZE);
|
||||
strlcpy(note.nsa_name, tcb->name, sizeof(note.nsa_name));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue