On Fri, Jan 19, 2018 at 11:03:02AM +0000, Roger Pau Monné wrote: > 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 <s...@prgmr.com> > > Signed-off-by: Wei Liu <wei.l...@citrix.com> > > Reviewed-by: Roger Pau Monné <roger....@citrix.com> > > Although I have a suggestion below. > > > --- > > Cc: Sarah Newman <s...@prgmr.com> > > Cc: Jan Beulich <jbeul...@suse.com> > > Cc: Andrew Cooper <andrew.coop...@citrix.com> > > Cc: Ian Jackson <ian.jack...@eu.citrix.com> > > > > 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. >
I would like to keep the increment of recv but I like the idea of not repeatedly checking idx. I will rearrange the code a bit. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel