lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b9f3fab-bfeb-5aa7-fc6a-26b9faa89417@linux.intel.com>
Date: Thu, 17 Oct 2024 14:35:55 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
cc: Philipp Stanner <pstanner@...hat.com>, Bjorn Helgaas <bhelgaas@...gle.com>, 
    linux-pci@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()

On Thu, 17 Oct 2024, Jonathan Cameron wrote:

> On Thu, 17 Oct 2024 12:55:45 +0300
> Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com> wrote:
> 
> > Use pci_resource_name() helper in pdev_sort_resources() to print
> > resources in user-friendly format. Also replace the vague "bogus
> > alignment" with a more precise explanation of the problem.
> > 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> > ---
> > 
> > v2:
> > - Place colon after %s %pR to be consistent with other printouts
> > - Replace vague "bogus alignment" with the exact cause
> > 
> >  drivers/pci/setup-bus.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> > index 23082bc0ca37..0fd286f79674 100644
> > --- a/drivers/pci/setup-bus.c
> > +++ b/drivers/pci/setup-bus.c
> > @@ -134,6 +134,7 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
> >  	int i;
> >  
> >  	pci_dev_for_each_resource(dev, r, i) {
> > +		const char *r_name = pci_resource_name(dev, i);
> >  		struct pci_dev_resource *dev_res, *tmp;
> >  		resource_size_t r_align;
> >  		struct list_head *n;
> > @@ -146,8 +147,8 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
> >  
> >  		r_align = pci_resource_alignment(dev, r);
> >  		if (!r_align) {
> > -			pci_warn(dev, "BAR %d: %pR has bogus alignment\n",
> > -				 i, r);
> > +			pci_warn(dev, "%s %pR: alignment must not be zero\n",
> > +				 r_name, r);
>
> Why bother with local variable if only used here?

No other reason than it seems to always be a local variable in the other 
places too regardless the number of uses.

> Absolutely fine if you have more code coming that uses it again though!
> 
> Otherwise seems sensible change.

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ