* [for-next][PATCH 1/4] tracing/histograms: Simplify last_cmd_set()
2023-10-26 1:27 [for-next][PATCH 0/4] tracing: Updates for 6.7 Steven Rostedt
@ 2023-10-26 1:27 ` Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 2/4] powerpc: Remove initialisation of readpos Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2023-10-26 1:27 UTC (permalink / raw)
To: linux-kernel
Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Christophe JAILLET,
Mukesh ojha
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Turn a kzalloc()+strcpy()+strncat() into an equivalent and less verbose
kasprintf().
Link: https://lore.kernel.org/linux-trace-kernel/30b6fb04dadc10a03cc1ad08f5d8a93ef623a167.1697899346.git.christophe.jaillet@wanadoo.fr
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Mukesh ojha <quic_mojha@quicinc.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index d06938ae0717..1abc07fba1b9 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -774,23 +774,16 @@ static void last_cmd_set(struct trace_event_file *file, char *str)
{
const char *system = NULL, *name = NULL;
struct trace_event_call *call;
- int len;
if (!str)
return;
- /* sizeof() contains the nul byte */
- len = sizeof(HIST_PREFIX) + strlen(str);
kfree(last_cmd);
- last_cmd = kzalloc(len, GFP_KERNEL);
+
+ last_cmd = kasprintf(GFP_KERNEL, HIST_PREFIX "%s", str);
if (!last_cmd)
return;
- strcpy(last_cmd, HIST_PREFIX);
- /* Again, sizeof() contains the nul byte */
- len -= sizeof(HIST_PREFIX);
- strncat(last_cmd, str, len);
-
if (file) {
call = file->event_call;
system = call->class->system;
--
2.42.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [for-next][PATCH 2/4] powerpc: Remove initialisation of readpos
2023-10-26 1:27 [for-next][PATCH 0/4] tracing: Updates for 6.7 Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 1/4] tracing/histograms: Simplify last_cmd_set() Steven Rostedt
@ 2023-10-26 1:27 ` Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 3/4] eventfs: Fix WARN_ON() in create_file_dentry() Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 4/4] eventfs: Fix typo in eventfs_inode union comment Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2023-10-26 1:27 UTC (permalink / raw)
To: linux-kernel
Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Christoph Hellwig,
Justin Stitt, Kent Overstreet, Petr Mladek, Andy Shevchenko,
Rasmus Villemoes, Sergey Senozhatsky, Michael Ellerman, Kees Cook,
Matthew Wilcox (Oracle)
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
While powerpc doesn't use the seq_buf readpos, it did explicitly
initialise it for no good reason.
Link: https://lore.kernel.org/linux-trace-kernel/20231024145600.739451-1-willy@infradead.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Kees Cook <keescook@chromium.org>
Fixes: d0ed46b60396 ("tracing: Move readpos from seq_buf to trace_seq")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
arch/powerpc/kernel/setup-common.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 2f1026fba00d..34975532e44c 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -601,7 +601,6 @@ struct seq_buf ppc_hw_desc __initdata = {
.buffer = ppc_hw_desc_buf,
.size = sizeof(ppc_hw_desc_buf),
.len = 0,
- .readpos = 0,
};
static __init void probe_machine(void)
--
2.42.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [for-next][PATCH 3/4] eventfs: Fix WARN_ON() in create_file_dentry()
2023-10-26 1:27 [for-next][PATCH 0/4] tracing: Updates for 6.7 Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 1/4] tracing/histograms: Simplify last_cmd_set() Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 2/4] powerpc: Remove initialisation of readpos Steven Rostedt
@ 2023-10-26 1:27 ` Steven Rostedt
2023-10-26 1:27 ` [for-next][PATCH 4/4] eventfs: Fix typo in eventfs_inode union comment Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2023-10-26 1:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
As the comment right above a WARN_ON() in create_file_dentry() states:
* Note, with the mutex held, the e_dentry cannot have content
* and the ei->is_freed be true at the same time.
But the WARN_ON() only has:
WARN_ON_ONCE(ei->is_free);
Where to match the comment (and what it should actually do) is:
dentry = *e_dentry;
WARN_ON_ONCE(dentry && ei->is_free)
Also in that case, set dentry to NULL (although it should never happen).
Link: https://lore.kernel.org/linux-trace-kernel/20231024123628.62b88755@gandalf.local.home
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/event_inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 09ab93357957..4d2da7480e5f 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -264,8 +264,9 @@ create_file_dentry(struct eventfs_inode *ei, struct dentry **e_dentry,
* Note, with the mutex held, the e_dentry cannot have content
* and the ei->is_freed be true at the same time.
*/
- WARN_ON_ONCE(ei->is_freed);
dentry = *e_dentry;
+ if (WARN_ON_ONCE(dentry && ei->is_freed))
+ dentry = NULL;
/* The lookup does not need to up the dentry refcount */
if (dentry && !lookup)
dget(dentry);
--
2.42.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [for-next][PATCH 4/4] eventfs: Fix typo in eventfs_inode union comment
2023-10-26 1:27 [for-next][PATCH 0/4] tracing: Updates for 6.7 Steven Rostedt
` (2 preceding siblings ...)
2023-10-26 1:27 ` [for-next][PATCH 3/4] eventfs: Fix WARN_ON() in create_file_dentry() Steven Rostedt
@ 2023-10-26 1:27 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2023-10-26 1:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
It's eventfs_inode not eventfs_indoe. There's no deer involved!
Link: https://lore.kernel.org/linux-trace-kernel/20231024131024.5634c743@gandalf.local.home
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
index 298d3ecaf621..64fde9490f52 100644
--- a/fs/tracefs/internal.h
+++ b/fs/tracefs/internal.h
@@ -37,7 +37,7 @@ struct eventfs_inode {
/*
* Union - used for deletion
* @del_list: list of eventfs_inode to delete
- * @rcu: eventfs_indoe to delete in RCU
+ * @rcu: eventfs_inode to delete in RCU
* @is_freed: node is freed if one of the above is set
*/
union {
--
2.42.0
^ permalink raw reply related [flat|nested] 5+ messages in thread