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: <CAHp75VeJ8ZiD=qQVfeahUjGZduFRJJ5683hn8f4810JYEzsCyw@mail.gmail.com>
Date:   Mon, 15 Nov 2021 16:14:21 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Robin Murphy <robin.murphy@....com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
        linux-rpi-kernel <linux-rpi-kernel@...ts.infradead.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        linux-pci <linux-pci@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Jim Quinlan <jim2101024@...il.com>,
        Nicolas Saenz Julienne <nsaenz@...nel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Rob Herring <robh@...nel.org>,
        Krzysztof WilczyƄski <kw@...ux.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v2 1/1] PCI: brcmstb: Use BIT() as __GENMASK() is for
 internal use only

On Mon, Nov 15, 2021 at 4:01 PM Robin Murphy <robin.murphy@....com> wrote:
> On 2021-11-15 11:20, Andy Shevchenko wrote:
> > Use BIT() as __GENMASK() is for internal use only. The rationale
> > of switching to BIT() is to provide better generated code. The
> > GENMASK() against non-constant numbers may produce an ugly assembler
> > code. On contrary the BIT() is simply converted to corresponding shift
> > operation.
>
> FWIW, If you care about code quality and want the compiler to do the
> obvious thing, why not specify it as the obvious thing:
>
>         u32 val = ~0 << msi->legacy_shift;

Obvious and buggy (from the C standard point of view)? :-)

> Personally I don't think that abusing BIT() in the context of setting
> multiple bits is any better than abusing __GENMASK()...

No, BIT() is not abused here, but __GENMASK().

After all it's up to you, folks, consider that as a bug report.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ