Re: [PATCH v7 1/2] acpi/ghes, cxl/pci: Process CXL CPER Protocol Errors

From: Koralahalli Channabasappa, Smita
Date: Tue Mar 04 2025 - 15:16:52 EST




On 3/4/2025 11:57 AM, Yazen Ghannam wrote:
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.

This is such a blunder. Thanks for pointing out Yazen. Let me fix in next revision.

Thanks
Smita

Thanks,
Yazen