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: <CAB=NE6XJUwBg46tNOt=Y9zpuM8jZbeV-G_ndTQCC0+uO=wOgzw@mail.gmail.com>
Date:	Thu, 25 Jun 2015 08:53:35 -0700
From:	"Luis R. Rodriguez" <mcgrof@...not-panic.com>
To:	Borislav Petkov <bp@...e.de>
Cc:	Ingo Molnar <mingo@...nel.org>, Arnd Bergmann <arnd@...db.de>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Andy Lutomirski <luto@...capital.net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Tomi Valkeinen <tomi.valkeinen@...com>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Toshi Kani <toshi.kani@...com>,
	linux-fbdev <linux-fbdev@...r.kernel.org>,
	"xen-devel@...ts.xensource.com" <xen-devel@...ts.xensource.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Suresh Siddha <sbsiddha@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Juergen Gross <jgross@...e.com>,
	Daniel Vetter <daniel.vetter@...ll.ch>,
	Dave Airlie <airlied@...hat.com>,
	Antonino Daplas <adaplas@...il.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	venkatesh.pallipadi@...el.com,
	Stefan Bader <stefan.bader@...onical.com>,
	Ville Syrjälä <syrjala@....fi>,
	Mel Gorman <mgorman@...e.de>, Vlastimil Babka <vbabka@...e.cz>,
	Davidlohr Bueso <dbueso@...e.de>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Ville Syrjälä <ville.syrjala@...ux.intel.com>,
	David Vrabel <david.vrabel@...rix.com>,
	Jan Beulich <jbeulich@...e.com>,
	Roger Pau Monné <roger.pau@...rix.com>
Subject: Re: [PATCH v8 5/9] PCI: Add pci_iomap_wc() variants

On Thu, Jun 25, 2015 at 8:09 AM, Borislav Petkov <bp@...e.de> wrote:
>> +void __iomem *pci_iomap_wc_range(struct pci_dev *dev,
>> +                              int bar,
>> +                              unsigned long offset,
>> +                              unsigned long maxlen)
>> +{
>> +     resource_size_t start = pci_resource_start(dev, bar);
>> +     resource_size_t len = pci_resource_len(dev, bar);
>> +     unsigned long flags = pci_resource_flags(dev, bar);
>> +
>> +     if (len <= offset || !start)
>> +             return NULL;
>> +     len -= offset;
>> +     start += offset;
>> +     if (maxlen && len > maxlen)
>> +             len = maxlen;
>> +     if (flags & IORESOURCE_IO)
>> +             return NULL;
>
> I've moved this check at the beginning of the function so that we bail
> out before doing the computations above it.

That indeed looks like a good optimization.

 Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ