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: <ddbf72a52cd5b6c5e2cba2c6f301d12be651e220.camel@perches.com>
Date:   Fri, 04 Jan 2019 10:37:57 -0800
From:   Joe Perches <joe@...ches.com>
To:     Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
        Andrey Smirnov <andrew.smirnov@...il.com>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Cc:     Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Fabio Estevam <fabio.estevam@....com>,
        Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Leonard Crestez <leonard.crestez@....com>,
        "A.s. Dong" <aisheng.dong@....com>,
        Richard Zhu <hongxing.zhu@....com>,
        "linux-imx@....com" <linux-imx@....com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/21] PCI: designware: Make use of IS_ALIGNED()

On Wed, 2019-01-02 at 09:33 +0000, Gustavo Pimentel wrote:
> On 21/12/2018 07:27, Andrey Smirnov wrote:
> > Make the intent a bit more clear as well as get rid of explicit
> > arithmetic by using IS_ALIGNED() to determine if "addr" is aligned to
> > "size". No functional change intended.
[]
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
[]
> > @@ -22,7 +22,7 @@
> >  
> >  int dw_pcie_read(void __iomem *addr, int size, u32 *val)
> >  {
> > -	if ((uintptr_t)addr & (size - 1)) {
> > +	if (!IS_ALIGNED((uintptr_t)addr, size)) {

The (uintptr_t) cast could probably be removed as well.

> > @@ -43,7 +43,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val)
> >  
> >  int dw_pcie_write(void __iomem *addr, int size, u32 val)
> >  {
> > -	if ((uintptr_t)addr & (size - 1))
> > +	if (!IS_ALIGNED((uintptr_t)addr, size))
> >  		return PCIBIOS_BAD_REGISTER_NUMBER;

here too

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ