arm/linux: zero-initialize stack buffers to fix Valgrind warnings (#376)
On modern arm64 kernels, /proc/cpuinfo may legitimately omit the
"Hardware" field. Other optional identification sources, such as
"Revision" or Android property-based identifiers, may also be absent
depending on the platform.
Default-initialize the corresponding stack buffers / structs so missing
optional identifiers are treated as empty values rather than
uninitialized memory.
diff --git a/src/arm/linux/init.c b/src/arm/linux/init.c
index 53e9a43..587317b 100644
--- a/src/arm/linux/init.c
+++ b/src/arm/linux/init.c
@@ -256,12 +256,12 @@
}
#if defined(__ANDROID__)
- struct cpuinfo_android_properties android_properties;
+ struct cpuinfo_android_properties android_properties = {0};
cpuinfo_arm_android_parse_properties(&android_properties);
#else
- char proc_cpuinfo_hardware[CPUINFO_HARDWARE_VALUE_MAX];
+ char proc_cpuinfo_hardware[CPUINFO_HARDWARE_VALUE_MAX] = {0};
#endif
- char proc_cpuinfo_revision[CPUINFO_REVISION_VALUE_MAX];
+ char proc_cpuinfo_revision[CPUINFO_REVISION_VALUE_MAX] = {0};
if (!cpuinfo_arm_linux_parse_proc_cpuinfo(
#if defined(__ANDROID__)