[PATCH v8 16/20] PCI/AER: Convert aer_get_device_error_info(), aer_print_error() to index
Bjorn Helgaas
helgaas at kernel.org
Sat May 24 02:12:43 AEST 2025
On Fri, May 23, 2025 at 02:13:52PM +0300, Ilpo Järvinen wrote:
> On Thu, 22 May 2025, Bjorn Helgaas wrote:
>
> > From: Bjorn Helgaas <bhelgaas at google.com>
> >
> > Previously aer_get_device_error_info() and aer_print_error() took a pointer
> > to struct aer_err_info and a pointer to a pci_dev. Typically the pci_dev
> > was one of the elements of the aer_err_info.dev[] array (DPC was an
> > exception, where the dev[] array was unused).
> > -void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
> > +void aer_print_error(struct aer_err_info *info, int i)
> > {
> > - int layer, agent;
> > - int id = pci_dev_id(dev);
> > + struct pci_dev *dev;
> > + int layer, agent, id;
> > const char *level = info->level;
> >
> > + if (i >= AER_MAX_MULTI_ERR_DEVICES)
> > + return;
>
> Are these OoB checks actually indication of a logic error in the caller
> side which would perhaps warrant using
> if (WARN_ON_ONCE(i >= AER_MAX_MULTI_ERR_DEVICES))
> ?
Good idea, thanks! I hope we can someday get rid of this info->dev[]
array and the headaches associated with it.
More information about the Linuxppc-dev
mailing list