From fc48f5bbf1be881dfef0622a5e6c74fa7af1da73 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Tue, 22 Aug 2017 05:00:02 +0800 Subject: [PATCH] MLK-16239 clk: imx: imx8qm/qxp: Adding the missing sentinel value of match table Need to put the sentinel value to the end of the of_device_id array. This patch also fixes the following KASAN complains when KASAN is enabled: [ 0.671315] ================================================================== [ 0.678400] BUG: KASAN: global-out-of-bounds in __of_match_node+0x70/0xb8 at addr ffff2000092958a8 [ 0.687321] Read of size 1 by task swapper/0/1 [ 0.691760] Address belongs to variable imx8qm_match+0xc8/0x260 [ 0.697666] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.11-03033-ge2e5fb2 #44 [ 0.704955] Hardware name: Freescale i.MX8QM ARM2 (DT) [ 0.710081] Call trace: [ 0.712528] [] dump_backtrace+0x0/0x278 [ 0.717907] [] show_stack+0x14/0x20 [ 0.722949] [] dump_stack+0xa4/0xc8 [ 0.727990] [] kasan_report_error+0x4c4/0x4d8 [ 0.733892] [] kasan_report+0x40/0x48 [ 0.739103] [] __asan_load1+0x4c/0x58 [ 0.744318] [] __of_match_node+0x70/0xb8 [ 0.749791] [] of_match_node+0x38/0x60 [ 0.755088] [] of_match_device+0x30/0x50 [ 0.760565] [] platform_match+0x6c/0x130 [ 0.766040] [] __device_attach_driver+0x5c/0x138 [ 0.772205] [] bus_for_each_drv+0xd0/0x130 [ 0.777852] [] __device_attach+0x13c/0x1a0 [ 0.783499] [] device_initial_probe+0x10/0x18 [ 0.789406] [] bus_probe_device+0xe0/0xf0 [ 0.794965] [] device_add+0x5c8/0x818 [ 0.800176] [] of_device_add+0x5c/0x88 [ 0.805477] [] of_platform_device_create_pdata+0xb4/0x118 [ 0.812426] [] of_platform_device_create+0x14/0x20 [ 0.818771] [] arm_smmu_of_init+0x38/0x50 [ 0.824332] [] of_iommu_init+0xa4/0x100 [ 0.829715] [] do_one_initcall+0x90/0x1c8 [ 0.835278] [] kernel_init_freeable+0x290/0x330 [ 0.841361] [] kernel_init+0x10/0x110 [ 0.846567] [] ret_from_fork+0x10/0x50 [ 0.851860] Memory state around the buggy address: [ 0.856648] ffff200009295780: fa fa fa fa 00 03 fa fa fa fa fa fa 00 00 00 00 [ 0.863854] ffff200009295800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0.871065] >ffff200009295880: 00 00 00 00 00 fa fa fa fa fa fa fa 00 00 00 00 [ 0.878270] ^ [ 0.882792] ffff200009295900: 02 fa fa fa fa fa fa fa 00 00 07 fa fa fa fa fa [ 0.890003] ffff200009295980: 00 00 00 00 01 fa fa fa fa fa fa fa 00 00 00 00 [ 0.897208] ================================================================== Signed-off-by: Jason Liu --- drivers/clk/imx/clk-imx8qm.c | 3 ++- drivers/clk/imx/clk-imx8qxp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/imx/clk-imx8qm.c b/drivers/clk/imx/clk-imx8qm.c index e11315d4f4c1..f736dc907a6d 100644 --- a/drivers/clk/imx/clk-imx8qm.c +++ b/drivers/clk/imx/clk-imx8qm.c @@ -874,7 +874,8 @@ static int imx8qm_clk_probe(struct platform_device *pdev) } static const struct of_device_id imx8qm_match[] = { - { .compatible = "fsl,imx8qm-clk", } + { .compatible = "fsl,imx8qm-clk", }, + { /* sentinel value */ } }; static struct platform_driver imx8qm_clk_driver = { diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c index 64e309766e44..b7e36b3a15c0 100644 --- a/drivers/clk/imx/clk-imx8qxp.c +++ b/drivers/clk/imx/clk-imx8qxp.c @@ -624,7 +624,8 @@ static int imx8qxp_clk_probe(struct platform_device *pdev) } static const struct of_device_id imx8qxp_match[] = { - { .compatible = "fsl,imx8qxp-clk", } + { .compatible = "fsl,imx8qxp-clk", }, + { /* sentinel value */ } }; static struct platform_driver imx8qxp_clk_driver = { -- 2.17.1