On Sun, 3 Dec 2023 10:33:32 +0900
Dominique Martinet <asmad...@codewreck.org> wrote:


> >             TP_printk("clnt %lu %s(tag = %d)\n%.3x: %16ph\n%.3x: %16ph\n",
> >                       (unsigned long)__entry->clnt, 
> > show_9p_op(__entry->type),
> >                       __entry->tag, 0, __get_dynamic_array(line), 16,
> >                   __get_dynamic_array(line) + 16)  
> 
> This was just printing garbage in the previous version but %16ph with a
> dynamic alloc would be out of range (even the start of the next buffer,
> _get_dynamic_array(line) + 16, can be out of range)
> 
> Also, for custom tracepoints e.g. bpftrace the program needs to know how
> many bytes can be read safely even if it's just for dumping -- unless
> dynamic_array is a "fat pointer" that conveys its own size?
> (Sorry didn't take the time to check)

Yes, there's also a __get_dynamic_array_len(line) that will return the
allocated length of the line. Is that what you need?

-- Steve



Reply via email to