Re: [PATCH RFC v5 5/7] ipmi: ls2k: Relax the dependency to its mfd driver
[email protected] Mon, 03 Aug 2026 17:09:06 +0000
| Newsgroups | dev.linux.lists.mfd |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: Pre-existing issues: - [High] Blind dereference of platform device resources without checking if= resources exist, leading to a potential NULL pointer dereference. -- --- Patch [5]: [PATCH RFC v5 5/7] ipmi: ls2k: Relax the dependency to its m= fd driver --- commit 41124ab927989929db3ae83837ad0e4e74e88d2e Author: Miao Wang <[email protected]> ipmi: ls2k: Relax the dependency to its mfd driver This commit changes the Kconfig dependency for the Loongson-2K IPMI interface from select to imply for MFD_LS2K_BMC_CORE. This allows the IPMI driver to be compiled independently of the MFD driver. > diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig > index 669f760001974..f456e3e894169 100644 > --- a/drivers/char/ipmi/Kconfig > +++ b/drivers/char/ipmi/Kconfig [ ... ] > @@ -87,7 +87,7 @@ config IPMI_IPMB > config IPMI_LS2K > bool 'Loongson-2K IPMI interface' > depends on LOONGARCH > - select MFD_LS2K_BMC_CORE > + imply MFD_LS2K_BMC_CORE [Severity: High] This is a pre-existing issue and was not introduced by the patch under review, but since this change allows the IPMI driver to probe independently of the MFD driver, I noticed a potential regression with resource handling. Looking at ipmi_ls2k_probe() in drivers/char/ipmi/ipmi_si_ls2k.c: io.addr_data =3D pdev->resource[0].start; io.regspacing =3D resource_size(&pdev->resource[0]); Does this code blindly dereference the platform device resources without checking if they exist? If the platform device is instantiated without resources (such as manually via sysfs, or due to a misconfigured MFD core or device tree), would pdev->resource be NULL and cause a kernel panic? Would it be safer to verify pdev->num_resources > 0 or use platform_get_resource() before accessing pdev->resource[0]? > help > Provides a driver for Loongson-2K IPMI interfaces. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260804-ls2kbmc-mo= [email protected]?part=3D5