summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamal Negi <kamaln@codeaurora.org>2016-11-18 10:39:51 +0530
committerKamal Negi <kamaln@codeaurora.org>2016-11-22 14:39:31 +0530
commit7bb0f627d3915da1ffacf0a57b8ebd302853af27 (patch)
tree7cd38e03bb708058ee8ba967e4602e91c11b48bc
parent7e4074908c5682bf7ccfeb8cf5fbab2e7d29034b (diff)
downloadandroid_hardware_qcom_fm-7bb0f627d3915da1ffacf0a57b8ebd302853af27.tar.gz
android_hardware_qcom_fm-7bb0f627d3915da1ffacf0a57b8ebd302853af27.tar.bz2
android_hardware_qcom_fm-7bb0f627d3915da1ffacf0a57b8ebd302853af27.zip
Memset structure values to 0 before sending an IOCTL
Memset ext_ctl and v4l2_ctls structure values to 0 before processing it. If not set, unassigned values can have garbage values and that can lead to functional/feature failure. CRs-Fixed: 1091284 Change-Id: Ice666cddd8e734d2d91053c30c42493315292841
-rw-r--r--jni/FmIoctlsInterface.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/jni/FmIoctlsInterface.cpp b/jni/FmIoctlsInterface.cpp
index 046ca1e..640a90f 100644
--- a/jni/FmIoctlsInterface.cpp
+++ b/jni/FmIoctlsInterface.cpp
@@ -111,6 +111,9 @@ int FmIoctlsInterface :: set_calibration
struct v4l2_ext_controls v4l2_ctls;
char cal_data[CAL_DATA_SIZE] = {0};
+ memset(&v4l2_ctls, 0, sizeof(v4l2_ctls));
+ memset(&ext_ctl, 0, sizeof(ext_ctl));
+
cal_fp = fopen(CALIB_DATA_NAME, "r");
if(cal_fp != NULL) {
if(fread(&cal_data[0], 1, CAL_DATA_SIZE, cal_fp)