From: Seung-Woo Kim Date: Tue, 1 Sep 2015 08:21:01 +0000 (+0900) Subject: fimc-is: 6d1: add sentinel element to id table X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5c9bffee16eb6cf39e879a2fd016bcf95a2cee6;p=platform%2Fkernel%2Flinux-exynos.git fimc-is: 6d1: add sentinel element to id table This patch adds sentinel element to id table to fix following out of bounds access: ================================================================== BUG: KASan: out of bounds access in i2c_device_match+0xcc/0xf0 at addr ffffffc00120ee80 Read of size 1 by task swapper/0/1 page:ffffffbdc0848380 count:1 mapcount:0 mapping: (null) index:0x0 flags: 0x400(reserved) page dumped because: kasan: bad access detected Address belongs to variable sensor_6d1_idt+0x20/0x40 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3 Hardware name: Samsung TM2 board (DT) Call trace: [] dump_backtrace+0x0/0x1d8 [] show_stack+0x10/0x20 [] dump_stack+0x80/0xd4 [] kasan_report_error+0x3e0/0x408 [] kasan_report+0x44/0x50 [] __asan_load1+0x78/0x80 [] i2c_device_match+0xc8/0xf0 [] __driver_attach+0x3c/0xd0 [] bus_for_each_dev+0xd4/0x138 [] driver_attach+0x2c/0x40 [] bus_add_driver+0x214/0x2e8 [] driver_register+0xb0/0x1c0 [] i2c_register_driver+0x48/0xc8 [] sensor_6d1_load+0x18/0x24 [] do_one_initcall+0xec/0x240 [] kernel_init_freeable+0x288/0x330 [] kernel_init+0xc/0xf0 Memory state around the buggy address: ffffffc00120ed80: 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fa fa ffffffc00120ee00: fa fa fa fa 00 00 06 fa fa fa fa fa 00 00 00 00 >ffffffc00120ee80: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffffffc00120ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffffc00120ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== Change-Id: I9db130c66d2aa884b946e946581e5dc08f8a20ca Signed-off-by: Seung-Woo Kim --- diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c index 2de119caff41..60ac264ae832 100644 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c +++ b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c @@ -780,6 +780,7 @@ static const struct of_device_id exynos_fimc_is_sensor_6d1_match[] = { static const struct i2c_device_id sensor_6d1_idt[] = { { SENSOR_NAME, 0 }, + {}, }; static struct i2c_driver sensor_6d1_driver = {