Re: [PATCH v7 1/2] acpi/ghes, cxl/pci: Process CXL CPER Protocol Errors
From: Yazen Ghannam
Date: Tue Mar 04 2025 - 14:57:52 EST
On Wed, Feb 26, 2025 at 10:11:56PM +0000, Smita Koralahalli wrote:
[...]
> +static void cxl_cper_handle_prot_err(struct cxl_cper_prot_err_work_data *data)
> +{
> + unsigned int devfn = PCI_DEVFN(data->prot_err.agent_addr.device,
> + data->prot_err.agent_addr.function);
> + struct pci_dev *pdev __free(pci_dev_put) =
> + pci_get_domain_bus_and_slot(data->prot_err.agent_addr.segment,
> + data->prot_err.agent_addr.bus,
> + devfn);
> +
> + guard(device)(&pdev->dev);
> + if (!pdev)
> + return;
> +
If 'pdev == NULL', then there would be a NULL pointer dereference in the
guard() statement, IIUC.
So I think the guard() statement should go after the NULL pointer check.
Thanks,
Yazen