LF-4300: ASoC: fsl_sai: Fix KASAN slab-out-of-bounds isuue
The regmap_config.max_register should match with regmap_config.reg_defaults definition, otherwise: [ 5.007222] ================================================================== [ 5.014592] BUG: KASAN: slab-out-of-bounds in regcache_flat_init+0xd0/0x120 [ 5.021635] Write of size 4 at addr ffff00000ab1d500 by task swapper/0/1 [ 5.028397] [ 5.029954] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.10.52-03729-gd820c2b9c5b0 #824 [ 5.037944] Hardware name: NXP i.MX8ULP EVK (DT) [ 5.042615] Call trace: [ 5.045142] dump_backtrace+0x0/0x2b4 [ 5.048884] show_stack+0x18/0x24 [ 5.052275] dump_stack+0xfc/0x168 [ 5.055757] print_address_description.constprop.0+0x6c/0x488 [ 5.061594] kasan_report+0x118/0x210 [ 5.065329] __asan_store4+0x98/0xd4 [ 5.068985] regcache_flat_init+0xd0/0x120 [ 5.073158] regcache_init+0x33c/0x72c [ 5.076982] __regmap_init+0xdf8/0x1730 [ 5.080896] __devm_regmap_init+0x70/0xc4 [ 5.084980] __devm_regmap_init_mmio_clk+0xd8/0x120 [ 5.089956] fsl_sai_probe+0x1c0/0xaf0 [ 5.093784] platform_drv_probe+0x70/0xd0 [ 5.097863] really_probe+0x148/0x704 [ 5.101595] driver_probe_device+0x78/0xec [ 5.105762] device_driver_attach+0x118/0x120 [ 5.110197] __driver_attach+0xb0/0x190 [ 5.114099] bus_for_each_dev+0xe8/0x160 [ 5.118092] driver_attach+0x34/0x44 [ 5.121736] bus_add_driver+0x1b8/0x2c0 [ 5.125641] driver_register+0xe0/0x210 [ 5.129552] __platform_driver_register+0x80/0x90 [ 5.134341] fsl_sai_driver_init+0x1c/0x28 [ 5.138512] do_one_initcall+0xa8/0x260 [ 5.142429] kernel_init_freeable+0x2cc/0x350 [ 5.146859] kernel_init+0x14/0x12c [ 5.150420] ret_from_fork+0x10/0x38 Fixes: 722eaf74 ("MLK-25556-7: ASoC: fsl_sai: add max_register in soc data") Signed-off-by:Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by:
Daniel Baluta <daniel.baluta@nxp.com> Reported-by:
Jason Liu <jason.hui.liu@nxp.com> Acked-by:
Jason Liu <jason.hui.liu@nxp.com>