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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 lib/tracefs/tracefs-utils.c | 3 +++
 1 file changed, 3 insertions(+)

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)
-- 
2.24.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux