RE: [PATCH] remoteproc: debug: remove strlen call in rproc_trace_read

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

 




> -----Original Message-----
> From: linux-remoteproc-owner@xxxxxxxxxxxxxxx <linux-remoteproc-
> owner@xxxxxxxxxxxxxxx> On Behalf Of Bjorn Andersson
> Sent: jeudi 8 novembre 2018 07:14
> To: Suman Anna <s-anna@xxxxxx>; Xiang Xiao
> <xiaoxiang781216@xxxxxxxxx>
> Cc: linux-remoteproc@xxxxxxxxxxxxxxx; Xiang Xiao <xiaoxiang@xxxxxxxxxx>
> Subject: Re: [PATCH] remoteproc: debug: remove strlen call in
> rproc_trace_read
> 
> On Wed 07 Nov 07:06 PST 2018, Xiang Xiao wrote:
> 
> > because the trace buffer may contain the binary data
> >
> 
> I think this patch is good.

It isn't for me as trace buffer is only used for printf like traces. If we read past the first \0 we will display some noise and depending on trace buffer size make trace buffer unreadable on console thanks to a basic 'cat'.
But I recognize binary trace format need.
I would suggest to add a parameter in trace resource to specify the type of trace: text or binary and adapt function behavior according to this.

Regards,
Loic
> 
> @Suman, as I know you're using this and would now read past the first \0
> in the buffer, do you have any objections to it?
> 
> Regards,
> Bjorn
> 
> > Signed-off-by: Xiang Xiao <xiaoxiang@xxxxxxxxxx>
> > ---
> >  drivers/remoteproc/remoteproc_debugfs.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/remoteproc/remoteproc_debugfs.c
> b/drivers/remoteproc/remoteproc_debugfs.c
> > index e90135c..0808466 100644
> > --- a/drivers/remoteproc/remoteproc_debugfs.c
> > +++ b/drivers/remoteproc/remoteproc_debugfs.c
> > @@ -48,9 +48,8 @@ static ssize_t rproc_trace_read(struct file *filp, char
> __user *userbuf,
> >  				size_t count, loff_t *ppos)
> >  {
> >  	struct rproc_mem_entry *trace = filp->private_data;
> > -	int len = strnlen(trace->va, trace->len);
> >
> > -	return simple_read_from_buffer(userbuf, count, ppos, trace->va,
> len);
> > +	return simple_read_from_buffer(userbuf, count, ppos, trace->va,
> trace->len);
> >  }
> >
> >  static const struct file_operations trace_rproc_ops = {
> > --
> > 2.7.4
> >



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux