Since commit 9a6944fee68e ("tracing: Add a verifier to check string pointers for trace events"), which was merged in v5.13-rc1, TP_printk() no longer tacitly supports the "%.*s" format specifier. Note that __string() and __assign_str() cannot be used for non-NUL-terminated C strings because they perform a strlen() on the string that is to be copied. Instead, memcpy the whole file name into the record, but display just the part up to the first NUL. In almost every case that will show the whole file name. Reported-by: David Wysochanski <dwysocha@xxxxxxxxxx> Fixes: 6019ce0742ca ("NFSD: Add a tracepoint to record directory entry encoding") Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> --- fs/nfsd/trace.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 27a93ebd1d80..781af519b40c 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -400,19 +400,17 @@ TRACE_EVENT(nfsd_dirent, TP_STRUCT__entry( __field(u32, fh_hash) __field(u64, ino) - __field(int, len) - __dynamic_array(unsigned char, name, namlen) + __dynamic_array(char, name, namlen + 1) ), TP_fast_assign( __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0; __entry->ino = ino; - __entry->len = namlen; memcpy(__get_str(name), name, namlen); - __assign_str(name, name); + __get_str(name)[namlen] = '\0'; ), - TP_printk("fh_hash=0x%08x ino=%llu name=%.*s", - __entry->fh_hash, __entry->ino, - __entry->len, __get_str(name)) + TP_printk("fh_hash=0x%08x ino=%llu name=%s", + __entry->fh_hash, __entry->ino, __get_str(name) + ) ) #include "state.h"