All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Imre Kaloz" <kaloz@kernel.org>
Cc: lee@kernel.org, linux-serial@vger.kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH 26/38] mfd: ioc3: add support for IOC4
Date: Sat, 03 Oct 2026 01:33:15 +0000	[thread overview]
Message-ID: <20261003013315.AA8541F000FF@smtp.kernel.org> (raw)
In-Reply-To: <ceef655fed6e8fdc2f7d34a82fd3e4eb21b64855.1790857966.git.kaloz@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] mfd: NULL pointer dereference due to complex pointer in pci_device_id match table
- [Low] mfd: ioc4_cells array is not static const
- [Low] mfd: ioc3: commit message capitalization violation
--

commit 6ec254319e574e5b3a17ca8a7e4c5206dfed5e04
Author: Imre Kaloz <kaloz@kernel.org>

mfd: ioc3: add support for IOC4

This commit adds support for IOC4, which is IOC3's successor on IP35 Origin
350-class boards. It reuses the serial and PS/2 drivers of IOC3 and splits
interrupt status into two banks.

> mfd: ioc3: add support for IOC4

[Severity: Low]
Does this commit title violate the MFD subsystem formatting requirements?

The MFD subsystem conventions mandate that the description after the subsystem
prefix must always be capitalized (e.g., "mfd: ioc3: Add support...").

> diff --git a/drivers/mfd/ioc3.c b/drivers/mfd/ioc3.c
> index 5f8ac364b610e..fd50bae0f10b3 100644
> --- a/drivers/mfd/ioc3.c
> +++ b/drivers/mfd/ioc3.c

[ ... ]

> @@ -565,8 +605,11 @@ static int ioc3_setup(struct ioc3_priv_data *ipd)
>  static int ioc3_mfd_probe(struct pci_dev *pdev,
>  			  const struct pci_device_id *pci_id)
>  {
> +	const struct ioc3_variant *var = (void *)pci_id->driver_data;

[Severity: High]
Is it safe to blindly retrieve the pointer from driver_data?

If the driver is bound to a device dynamically via the sysfs 'new_id'
interface (where driver_data often defaults to 0), the 'var' pointer becomes
NULL.

>  	struct ioc3_priv_data *ipd;
> -	struct ioc3 __iomem *regs;
> +	void __iomem *base;
> +	unsigned int i;
> +	u16 cmd;
>  	int ret;
>  
>  	ret = pci_enable_device(pdev);
> @@ -576,6 +619,12 @@ static int ioc3_mfd_probe(struct pci_dev *pdev,
>  	pci_write_config_byte(pdev, PCI_LATENCY_TIMER, IOC3_LATENCY);
>  	pci_set_master(pdev);
>  
> +	if (var->pci_command) {

[Severity: High]
Does this cause a NULL pointer dereference if 'var' is NULL?

As mentioned above, if 'driver_data' is 0, 'var' will be NULL, leading to a
crash here. The MFD subsystem guidelines explicitly prohibit passing complex
pointers through match data tables and mandate using an integer ID/enum,
selecting the static const data in the probe function.

[ ... ]

> @@ -649,12 +708,152 @@ static void ioc3_mfd_remove(struct pci_dev *pdev)

[ ... ]

> +#define IOC4_SERIAL_CELL(port) {					\
> +	.name = "ioc3-serial8250",					\
> +	.resources = ioc4_uart_resources[port],				\
> +	.num_resources = ARRAY_SIZE(ioc4_uart_resources[port]),		\
> +	.platform_data = &ioc4_serial_pdata,				\
> +	.pdata_size = sizeof(ioc4_serial_pdata),			\
> +}
> +
> +static struct mfd_cell ioc4_cells[] = {

[Severity: Low]
Should this array be declared as 'static const'?

The MFD subsystem guidelines strictly require that mfd_cell arrays must be
defined as 'static const' to prevent dynamic platform data amendments and
memory safety hazards. The newly introduced 'ioc4_cells' array is missing the
'const' qualifier.

> +	IOC4_SERIAL_CELL(0),
> +	IOC4_SERIAL_CELL(1),

[ ... ]

> +static const struct ioc3_variant ioc4_variant = {
> +	.name = "IOC4",
> +	.chip = &ioc4_irq_chip,
> +	.banks = ioc4_irq_banks,
> +	.nr_banks = ARRAY_SIZE(ioc4_irq_banks),
> +	.nr_irqs = IOC4_NUM_IRQS,
> +	/* Parity and SERR# reporting, as the SN2 IOC4 core enabled them. */
> +	.pci_command = PCI_COMMAND_PARITY | PCI_COMMAND_SERR,
> +	.setup = ioc4_setup,
> +};
> +
>  static struct pci_device_id ioc3_mfd_id_table[] = {
> -	{ PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3, PCI_ANY_ID, PCI_ANY_ID },
> +	{ PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3, PCI_ANY_ID, PCI_ANY_ID,
> +	  0, 0, (kernel_ulong_t)&ioc3_variant },
> +	{ PCI_VENDOR_ID_SGI, 0x100a, PCI_ANY_ID, PCI_ANY_ID,
> +	  0, 0, (kernel_ulong_t)&ioc4_variant },
>  	{ 0, },
>  };

[Severity: High]
Is it safe to embed complex pointers in the match table?

The patch passes a pointer to 'ioc3_variant' / 'ioc4_variant' through the
pci_device_id match table's driver_data field. The MFD subsystem guidelines
explicitly prohibit this and mandate using an integer ID/enum, selecting the
static const data in the probe function instead.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790857966.git.kaloz@kernel.org?part=26

  reply	other threads:[~2026-10-03  1:33 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 16:11 [PATCH 00/38] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
2026-10-01 16:11 ` [PATCH 01/38] MIPS: Xtalk: guard the widget identification table from assembly Imre Kaloz
2026-10-01 16:11 ` [PATCH 02/38] MIPS: SGI-IP27: dump the NMI save areas the CPU scan recorded Imre Kaloz
2026-10-01 16:11 ` [PATCH 03/38] MIPS: SGI-IP27: add REMOTE_HUB_PI_S()/REMOTE_HUB_PI_L() Imre Kaloz
2026-10-01 16:11 ` [PATCH 04/38] MIPS: SGI-IP27: detect Bedrock hubs at boot Imre Kaloz
2026-10-01 16:11 ` [PATCH 05/38] MIPS: SGI-IP27: widen Kconfig for the Bedrock-based machines Imre Kaloz
2026-10-01 16:11 ` [PATCH 06/38] MIPS: SGI-IP27: fold the dead SN1 arm out of klconfig.h Imre Kaloz
2026-10-01 16:11 ` [PATCH 07/38] MIPS: SGI-IP27: choose the node address layout at runtime Imre Kaloz
2026-10-01 16:11 ` [PATCH 08/38] MIPS: SGI-IP27: add the Bedrock hub register windows Imre Kaloz
2026-10-01 16:11 ` [PATCH 09/38] MIPS: SGI-IP27: decode a Bedrock hub's node id and system size Imre Kaloz
2026-10-01 16:11 ` [PATCH 10/38] MIPS: SGI-IP27: put a Bedrock hub's boot CPU in slot 0 Imre Kaloz
2026-10-01 16:11 ` [PATCH 11/38] MIPS: SGI-IP27: lay out node memory in 1GB banks on Bedrock hubs Imre Kaloz
2026-10-01 16:11 ` [PATCH 12/38] MIPS: SGI-IP27: reserve the bottom 64MB of node 0 " Imre Kaloz
2026-10-01 16:11 ` [PATCH 13/38] MIPS: SGI-IP27: route interrupt masks and slices through both PIs Imre Kaloz
2026-10-01 16:11 ` [PATCH 14/38] MIPS: SGI-IP27: address a CPU's own PI for NMI, IPI and RT counter Imre Kaloz
2026-10-01 16:11 ` [PATCH 15/38] MIPS: SGI-IP27: take a CPU's node from the CPU table in per_cpu_init() Imre Kaloz
2026-10-01 16:11 ` [PATCH 16/38] MIPS: SGI-IP27: resolve the mapped-kernel node shift at runtime Imre Kaloz
2026-10-01 16:11 ` [PATCH 17/38] MIPS: SGI-IP27: load the kernel at node offset 0x40000 Imre Kaloz
2026-10-01 16:11 ` [PATCH 18/38] MIPS: SGI-IP27: xbow_probe(): recognize KLTYPE_PBRICK_XBOW Imre Kaloz
2026-10-01 16:11 ` [PATCH 19/38] MIPS: ip27_defconfig: enable the IOC3 MFD, its cell drivers and tg3 Imre Kaloz
2026-10-01 16:11 ` [PATCH 20/38] net: ethernet: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses Imre Kaloz
2026-10-01 16:11 ` [PATCH 21/38] MIPS: SGI-IP27: route XBridge and PIC DMA through the 32-bit window Imre Kaloz
2026-10-05  8:39   ` Christoph Hellwig
2026-10-05 13:15     ` Imre Kaloz
2026-10-01 16:11 ` [PATCH 22/38] MIPS: SGI-IP27: recognize the PXBow crossbar Imre Kaloz
2026-10-01 16:11 ` [PATCH 23/38] MIPS: PCI: xtalk-bridge: recognize the PIC widget's 64-bit-only registers Imre Kaloz
2026-10-01 16:11 ` [PATCH 24/38] MIPS: PCI: xtalk-bridge: match PIC's register-level differences Imre Kaloz
2026-10-01 16:12 ` [PATCH 25/38] rtc: m48t35: support the SGI IP35 timekeeper's 1968 year base Imre Kaloz
2026-10-03  1:33   ` sashiko-bot
2026-10-01 16:12 ` [PATCH 26/38] mfd: ioc3: add support for IOC4 Imre Kaloz
2026-10-03  1:33   ` sashiko-bot [this message]
2026-10-01 16:12 ` [PATCH 27/38] MIPS: SGI-IP27: dispatch the early console between IOC3 and IOC4 Imre Kaloz
2026-10-01 16:12 ` [PATCH 28/38] MIPS: SGI-IP27: add L1 system controller support Imre Kaloz
2026-10-01 16:12 ` [PATCH 29/38] MIPS: SGI-IP27: wire the L1 into reset and the Ethernet address Imre Kaloz
2026-10-01 16:12 ` [PATCH 30/38] MIPS: PCI: xtalk-bridge: take the board part number from the L1 Imre Kaloz
2026-10-01 16:12 ` [PATCH 31/38] mfd: ioc3: add IP34 system-board entry to ioc3_infos[] Imre Kaloz
2026-10-02 10:02   ` Lee Jones
2026-10-02 10:29     ` Imre Kaloz
2026-10-01 16:12 ` [PATCH 32/38] net: ethernet: sgi: ioc3-eth: fall back to the platform MAC address Imre Kaloz
2026-10-01 16:12 ` [PATCH 33/38] MIPS: SGI-IP27: don't register a w1 master on an XBridge or PIC Imre Kaloz
2026-10-01 16:12 ` [PATCH 34/38] MIPS: SGI-IP27: report a Bedrock machine as SGI IP35 Imre Kaloz
2026-10-01 16:12 ` [PATCH 35/38] MIPS: SGI-IP27: identify the machine by the L1 brick type Imre Kaloz
2026-10-01 16:12 ` [PATCH 36/38] MIPS: SGI-IP27: register the Odyssey graphics widget Imre Kaloz
2026-10-01 16:12 ` [PATCH 37/38] MIPS: SGI-IP27: take the console from the KLCONFIG header on IP35 Imre Kaloz
2026-10-01 16:12 ` [PATCH 38/38] MIPS: SGI-IP27: give each CPU its own topology package id Imre Kaloz
2026-10-02 15:46 ` [PATCH 00/38] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Thomas Bogendoerfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261003013315.AA8541F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kaloz@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.