Files
kernel_google_wahoo/drivers/input
Javi Merino 0b3f432326 input: touch: ftm4: Fix length of memset() to avoid using uninitialized memory
When building the kernel with gcc 7.2, the compiler detects a
misleading memset() construct:

drivers/input/touchscreen/stm/ftm4_pdc.c: In function 'store_cmd':
drivers/input/touchscreen/stm/ftm4_pdc.c:470:2: error: 'memset' used with length equal to number of elements without mu
ltiplication by element size [-Werror=memset-elt-size]
  memset(info->cmd_param, 0x00, ARRAY_SIZE(info->cmd_param));
  ^~~~~~

info->cmd_param is a an array of ints.  ARRAY_SIZE gives you the
number of ints in the array (CMD_PARAM_NUM in this case).  However,
memset is expecting the number of bytes to zero, which is 4x the
number of ints in the array.

Use sizeof() to zero out the whole array and potentially avoid using
uninitialized memory.

Bug: 78364203
Change-Id: I24207ca94bf34ad26d90b4929d6bbbf9edf3c49e
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Steve Pfetsch <spfetsch@google.com>
2018-06-06 00:37:48 +00:00
..