From 900b8b72c57cefebb39c150dfddfdd493a1cea79 Mon Sep 17 00:00:00 2001 From: Steve Pfetsch Date: Mon, 7 Nov 2016 16:20:11 -0800 Subject: [PATCH] input: ldaf: Initialize buffers before use. Prevent writing uninitialized stack data to calibration files by zeroing out buffers upon creation. Bug: 31799972 Bug: 31795790 Change-Id: Ic848d4d1e181818f461e4b61ad73ada28a474bd1 --- drivers/input/misc/vl6180/stmvl6180_module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/vl6180/stmvl6180_module.c b/drivers/input/misc/vl6180/stmvl6180_module.c index c61cc0f063424..78bc7f6844c33 100755 --- a/drivers/input/misc/vl6180/stmvl6180_module.c +++ b/drivers/input/misc/vl6180/stmvl6180_module.c @@ -107,7 +107,7 @@ static int stmvl6180_stop(struct stmvl6180_data *data); static void stmvl6180_read_calibration_file(void) { struct file *f; - char buf[8]; + char buf[8] = {0}; mm_segment_t fs; int i, is_sign = 0; @@ -184,7 +184,7 @@ static void stmvl6180_read_calibration_file(void) static void stmvl6180_write_offset_calibration_file(void) { struct file *f = NULL; - char buf[8]; + char buf[8] = {0}; mm_segment_t fs; f = filp_open(CAL_FILE_OFFSET, O_CREAT | O_TRUNC | O_RDWR, @@ -207,7 +207,7 @@ static void stmvl6180_write_offset_calibration_file(void) static void stmvl6180_write_xtalk_calibration_file(void) { struct file *f = NULL; - char buf[8]; + char buf[8] = {0}; mm_segment_t fs; f = filp_open(CAL_FILE_XTALK, O_CREAT | O_TRUNC | O_RDWR,