Skip to content

Commit a4833e3

Browse files
rostedtchucklever
authored andcommitted
SUNRPC: Fix rpcgss_context trace event acceptor field
The rpcgss_context trace event acceptor field is a dynamically sized string that records the "data" parameter. But this parameter is also dependent on the "len" field to determine the size of the data. It needs to use __string_len() helper macro where the length can be passed in. It also incorrectly uses strncpy() to save it instead of __assign_str(). As these macros can change, it is not wise to open code them in trace events. As of commit c759e60 ("tracing: Remove __assign_str_len()"), __assign_str() can be used for both __string() and __string_len() fields. Before that commit, __assign_str_len() is required to be used. This needs to be noted for backporting. (In actuality, commit c1fa617 ("tracing: Rework __assign_str() and __string() to not duplicate getting the string") is the commit that makes __string_str_len() obsolete). Cc: stable@vger.kernel.org Fixes: 0c77668 ("SUNRPC: Introduce trace points in rpc_auth_gss.ko") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 10396f4 commit a4833e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/trace/events/rpcgss.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ TRACE_EVENT(rpcgss_context,
609609
__field(unsigned int, timeout)
610610
__field(u32, window_size)
611611
__field(int, len)
612-
__string(acceptor, data)
612+
__string_len(acceptor, data, len)
613613
),
614614

615615
TP_fast_assign(
@@ -618,7 +618,7 @@ TRACE_EVENT(rpcgss_context,
618618
__entry->timeout = timeout;
619619
__entry->window_size = window_size;
620620
__entry->len = len;
621-
strncpy(__get_str(acceptor), data, len);
621+
__assign_str(acceptor, data);
622622
),
623623

624624
TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",

0 commit comments

Comments
 (0)