diff mbox series

[RESEND,2/2] tracing: Change `if (strlen(glob))` to `if (glob[0])`

Message ID 20220417185630.199062-3-ammarfaizi2@gnuweeb.org (mailing list archive)
State Accepted
Commit 0267f188a27fd0146f6a644c0fdf8a4d63b69950
Headers show
Series Two tracing patches for trace_events_hist.c | expand

Commit Message

Ammar Faizi April 17, 2022, 6:56 p.m. UTC
No need to traverse to the end of string. If the first byte is not a NUL
char, it's guaranteed `if (strlen(glob))` is true.

Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---
 kernel/trace/trace_events_hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 0b99ad68e3fa..1968e497ef44 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -6189,7 +6189,7 @@  static int event_hist_trigger_parse(struct event_command *cmd_ops,
 	if (WARN_ON(!glob))
 		return -EINVAL;
 
-	if (strlen(glob)) {
+	if (glob[0]) {
 		hist_err_clear();
 		last_cmd_set(file, param);
 	}