On Tue, 20 May 2025 16:50:18 -0500 Bjorn Helgaas <helg...@kernel.org> wrote:
> From: Bjorn Helgaas <bhelg...@google.com> > > 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. > > Signed-off-by: Bjorn Helgaas <bhelg...@google.com> > Tested-by: Krzysztof Wilczyński <kwilczyn...@kernel.org> > Reviewed-by: Kuppuswamy Sathyanarayanan > <sathyanarayanan.kuppusw...@linux.intel.com> I chased this through a bit and looks like at least some unset fields would result in garbage prints. So maybe needs a fixes tag? info->tlp_header_valid is an easy one to follow as only set in some paths. Otherwise absolutely makes sense. Reviewed-by: Jonathan Cameron <jonathan.came...@huawei.com> > --- > drivers/pci/pcie/dpc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c > index df42f15c9829..3daaf61c79c9 100644 > --- a/drivers/pci/pcie/dpc.c > +++ b/drivers/pci/pcie/dpc.c > @@ -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);