patacongo commented on code in PR #15320:
URL: https://github.com/apache/nuttx/pull/15320#discussion_r1896760310


##########
libs/libc/stdio/lib_libvsprintf.c:
##########
@@ -911,6 +915,11 @@ static int vsprintf_internal(FAR struct lib_outstream_s 
*stream,
           size = 1;
           goto str_lpad;
 
+        case 'm': /* Print error message (%m) */
+          pnt = strerror(saved_errno);
+          size = strlen(pnt); /* Adjusting the size is not supported by %m */
+          goto str_lpad;
+

Review Comment:
   > So curious. In my machine, it works as expected:
   
   It will work in one case:  (1) The syscall is a simple, linear, sequence of 
calls,  (3) the caller of the syscall is the main thread of the task group or 
this is not a KERNEL build).
   
   But this can fail in the KERNEL mode due to MMU mappings that may no be in 
place to track to access the required TLS data.
   
   The system call like this is the most trivial case.  How about a true kernel 
thread that has no error number?  How about an interrupt handler that interrupt 
who knows what.
   
   The logic of this change is dangerous and incorrect and should never have 
been merged.  Now what are going to do?  There are two choices: fix it or 
remove it.  Leaving it alone a pretending there is not problem is not 
acceptable.
   



-- 
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

Reply via email to