[ltt-dev] [LTTNG-MODULES PATCH] copy_from_user and memset

Mathieu Desnoyers compudj at krystal.dyndns.org
Tue Sep 27 07:46:48 EDT 2011


* Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote:
> * Julien Desfossez (julien.desfossez at polymtl.ca) wrote:
> > This patch provides the copy_from_user and memset operations for the lib
> > ringbuffer.
> > 
> > Signed-off-by: Julien Desfossez <julien.desfossez at polymtl.ca>
[...]
> > +#undef tp_copy_string_from_user
> > +#define tp_copy_string_from_user(dest, src, len)			\
> > +	__assign_##dest:						\
> > +	if (0)								\
> > +		(void) __typemap.dest;					\
> > +	lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest));	\
> > +	__chan->ops->event_write_from_user(&__ctx, src, len - 1);	\
> 
> Hrm, thinking about it, it would make sense to have the caller to:
> 
> somelen assigned from   strlen(input);
> 
> tp_copy_string_from_user(dest, src, somelen)
> 
> So the "len - 1" here could be turned into "len", but we should comment
> that tp_copy_string_from_user takes the length without the \0, and that
> we implicitly add the \0. Makes sense ?

Hi Julien,

I did the modifications and merged your patch, thanks!

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list