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


##########
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:
   > However, is it a problem? I mean, when using `vsprintf` from the "kernel" 
when in flat builds, it should be as simple as avoiding the `%m` modifier, so 
the `saved_errno` will store garbage that is not used at all - and if a 
developer decides to use the undocumented `%m` from within the kernel in a flat 
build, it's up to his responsibility. This will allow user-space to freely use 
the `%m` modifier.
   
   * in some context, accessing errno can crash. (eg. NULL dereference)
   * also, i'm afraid that it isn't that simple to say "don't use this in 
kernel" when/if someone started to use it within a library.
   



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