[igt-dev] [PATCH 1/1] lib/vfs_file_max(): initialize static variable

Caz Yokoyama caz.yokoyama at intel.com
Tue Apr 16 13:57:31 UTC 2019


I believe un-initialized static variable is most probably not zero.
Correct me if I am wrong.

Signed-off-by: Caz Yokoyama <caz.yokoyama at intel.com>
---
 lib/intel_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/intel_os.c b/lib/intel_os.c
index dd93bea1..a4fe6b34 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -281,7 +281,7 @@ void *intel_get_total_pinnable_mem(size_t *total)
 
 static uint64_t vfs_file_max(void)
 {
-	static long long unsigned max;
+	static long long unsigned max = 0;
 	if (max == 0) {
 		FILE *file = fopen("/proc/sys/fs/file-max", "r");
 		max = 80000;
-- 
2.17.1



More information about the igt-dev mailing list