diff mbox series

[3/9] trace-cmd: Add sanity check of tracefs_get_tracing_file() input parameter.

Message ID 20200129095421.881786-4-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Commit c67788e4196f87d987b4287c92a1b9cd1080938d
Headers show
Series libtracefs: few fixes and a lot of unit tests | expand

Commit Message

Tzvetomir Stoyanov (VMware) Jan. 29, 2020, 9:54 a.m. UTC
The input parameter "name" of tracefs_get_tracing_file() API is mandatory,
it cannot be NULL. A check is added to verify this.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 lib/tracefs/tracefs-utils.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/lib/tracefs/tracefs-utils.c b/lib/tracefs/tracefs-utils.c
index de46aab..227990a 100644
--- a/lib/tracefs/tracefs-utils.c
+++ b/lib/tracefs/tracefs-utils.c
@@ -161,6 +161,9 @@  char *tracefs_get_tracing_file(const char *name)
 	char *file;
 	int ret;
 
+	if (!name)
+		return NULL;
+
 	if (!tracing) {
 		tracing = tracefs_find_tracing_dir();
 		if (!tracing)