patacongo commented on code in PR #15320: URL: https://github.com/apache/nuttx/pull/15320#discussion_r1896205028
########## libs/libc/stdio/lib_libvsprintf.c: ########## @@ -163,6 +163,10 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream, uint16_t flags; int width; int prec; + + /* For the %m format we may need the current `errno' value */ + + int saved_errno = errno; Review Comment: This could be used by Kernal threads, right? Kernel threads do not have errno variables. Wouldn't this logic just grab garabage out of the Kernel thread's non-existent TLS? On a system call, the correct errno may or may not be accessible. This change is unsafe: In some situations crashes could occur (e.g., multithreaded KERNEL mode, small stacks for Kernel threads, etc.) Basically, errno should not be used from within kernel logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org