On 2025-01-03 20:58, Denis Mukhin via B4 Relay wrote:
From: Denis Mukhin <dmuk...@ford.com>

There are several console drivers which have same checks w.r.t. printable
characters. The check is moved to new is_console_printable() function and
re-used in the UART emulation / guest logging code.

Also, MISRA rule 21.13 for ctype.h has been exploited while working on
the code change, reference the rule from ctype.h for future engineers.

Signed-off-by: Denis Mukhin <dmuk...@ford.com>

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 
7da8c5296f3b62c6c45131c58fe5cf0e393e9ef3..4cb397116b44935214801c496b30e44c9399c59a
 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -674,7 +674,7 @@ static long 
guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer,
                  c = *kin++;
                  if ( c == '\n' )
                      break;
-                if ( isprint(c) || c == '\t' )
+                if ( is_console_printable(c) )
                      *kout++ = c;

This `if` now accepts newline, but newline is already handled above. So it seems okay to me.

Reviewed-by: Jason Andryuk <jason.andr...@amd.com>

              } while ( --kcount > 0 );

Reply via email to