On Thu, Jan 18, 2018 at 06:16:51PM +0000, Wei Liu wrote:
> According to [0], some program sends NUL for padding purpose. We can
> discard them.
> 
> https://www.gnu.org/software/termutils/manual/termcap-1.3/html_mono/termcap.html#SEC7
> 
> Reported-by: Sarah Newman <[email protected]>
> Signed-off-by: Wei Liu <[email protected]>

Reviewed-by: Roger Pau Monné <[email protected]>

Although I have a suggestion below.

> ---
> Cc: Sarah Newman <[email protected]>
> Cc: Jan Beulich <[email protected]>
> Cc: Andrew Cooper <[email protected]>
> Cc: Ian Jackson <[email protected]>
> 
> A bit RFC. Awaiting test results.
> ---
>  xen/drivers/char/consoled.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/drivers/char/consoled.c b/xen/drivers/char/consoled.c
> index 552abf5766..6fcb2aa115 100644
> --- a/xen/drivers/char/consoled.c
> +++ b/xen/drivers/char/consoled.c
> @@ -72,7 +72,9 @@ size_t consoled_guest_rx(void)
>      {
>          char c = cons_ring->out[MASK_XENCONS_IDX(cons++, cons_ring->out)];

You could also do:

if ( c == '\0' )
    continue;

recv AFAICT it's just a cosmetic return value that's not consumed by
the caller. This avoids checking the "idx >= BUF_SZ" condition with
the same idx value.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to