PCI/DPC: Initialize aer_err_info before using it
authorBjorn Helgaas <bhelgaas@google.com>
Thu, 22 May 2025 23:21:07 +0000 (18:21 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 23 May 2025 15:58:52 +0000 (10:58 -0500)
Previously the struct aer_err_info "info" was allocated on the stack
without being initialized, so it contained junk except for the fields we
explicitly set later.

Initialize "info" at declaration so it starts as all zeros.

Fixes: 8aefa9b0d910 ("PCI/DPC: Print AER status in DPC event handling")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://patch.msgid.link/20250522232339.1525671-2-helgaas@kernel.org
drivers/pci/pcie/dpc.c

index df42f15c98295f38f522b3000bbabd9f64d0a2ab..3daaf61c79c9fb31723cc46f0bc2786b08de849a 100644 (file)
@@ -258,7 +258,7 @@ static int dpc_get_aer_uncorrect_severity(struct pci_dev *dev,
 void dpc_process_error(struct pci_dev *pdev)
 {
        u16 cap = pdev->dpc_cap, status, source, reason, ext_reason;
-       struct aer_err_info info;
+       struct aer_err_info info = {};
 
        pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
        pci_read_config_word(pdev, cap + PCI_EXP_DPC_SOURCE_ID, &source);