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] [day] [month] [year] [list]
Date:   Wed, 14 Dec 2022 23:30:58 -0500
From:   Luben Tuikov <luben.tuikov@....com>
To:     Robin Murphy <robin.murphy@....com>, iommu@...ts.linux.dev
Cc:     Christoph Hellwig <hch@....de>,
        Alex Deucher <Alexander.Deucher@....com>,
        Christian König <christian.koenig@....com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dma-direct: Optimize get_required_mask

On 2022-12-14 15:57, Robin Murphy wrote:
> On 2022-12-14 18:00, Luben Tuikov wrote:
>> Optimize dma_direct_get_required_mask(), in that we don't need to multiply by
>> two if we don't subtract 1 from the exponent. That is,
>>
>>      (1 << (n - 1)) * 2 - 1 <==>
>>      2^(n-1) * 2^1 - 1       = (by rule of exponents)
>>      2^n - 1                 <==>
>>      (1 << n) - 1.
> 
> ...except when n==64 (for the actual code below), in which case the 
> result of the shift becomes undefined.

Oh, right, for bit 63 being set. Forgot about that one. Good call.

Thanks,
Luben

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ