ir: fix ir memory overflow issue
authorjiamin ma <jiamin.ma@amlogic.com>
Wed, 9 May 2018 00:44:20 +0000 (08:44 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Thu, 10 May 2018 04:32:04 +0000 (21:32 -0700)
commit41a30dee3d718852d4265d14b620d6a994c5d1dc
tree3d22ea332a8d1bb6c4170fb9cc0420f7899d5584
parent160f1e245e3af1b41725472e605cda54b7dfdd5f
ir: fix ir memory overflow issue

PD#164774: kernel panic after mtk_cfg80211_set_power_mgmt

two possible overflow cases:
1. dev->debug_current + len == dev->debug_buffer_size
2. len > dev->debug_buffer_size

for the first case(currently triggered case)
  the last byte of string pointed to by fmt, aka.'\0', will
overwrite the first byte of memory pointed to by header(in
function __register_sysctl_table), which is just the LSB of
ipv4_table[]'s base address. Leading to "Unable to handle
kernel paging request at virtual address xxxx" panic

for the second case
  a bunch of memory pointed to by header(in function
__register_sysctl_table) will be overwritten

Change-Id: I6bc42308323b7ffb52fe4d1fa9d22742a31e8b1f
Signed-off-by: jiamin ma <jiamin.ma@amlogic.com>
drivers/amlogic/input/remote/sysfs.c