[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 8/9] xen/consoled: discard NUL from guest



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 <srn@xxxxxxxxx>
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Although I have a suggestion below.
> 
> > ---
> > Cc: Sarah Newman <srn@xxxxxxxxx>
> > Cc: Jan Beulich <jbeulich@xxxxxxxx>
> > Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > 
> > 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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.