Re: [PATCH 04/28] mfd: ls2kbmc: Allocate simplefb platform_data on the heap
From: Andy Shevchenko
Date: Wed Oct 21 2026 - 10:02:19 EST
On Wed, Oct 21, 2026 at 12:09:26PM +0000, Lee Jones wrote:
> ls2k_bmc_probe() declares struct simplefb_platform_data on the stack and
> assigns its address to the display MFD cell. Although mfd_add_device()
> deep-copies platform_data via platform_device_add_data() before
> ls2k_bmc_probe() returns, the shallow mfd_cell copy attached to the
> child platform device retains a stale pointer to the expired stack
> frame.
>
> Allocate the simplefb_platform_data structure on the heap via
> devm_kzalloc() prior to devm_mfd_add_devices() so the pointer remains
> valid for the lifetime of the child platform device.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
assuming you will add Reported-by: Sashiko...
--
With Best Regards,
Andy Shevchenko