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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67ebbdb2-b7db-6945-fa30-22ca2ddb5b32@redhat.com>
Date:   Mon, 13 Jan 2020 11:04:41 -0500
From:   Waiman Long <longman@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>,
        linux-kernel@...r.kernel.org, Bart Van Assche <bvanassche@....org>
Subject: Re: [PATCH v2 4/6] locking/lockdep: Reuse freed chain_hlocks entries

On 1/13/20 10:51 AM, Peter Zijlstra wrote:
> On Mon, Dec 16, 2019 at 10:15:15AM -0500, Waiman Long wrote:
>> +#define CHAIN_HLOCKS_MASK	0xffff
>> +static inline void set_chain_block(int offset, int size, int next)
>> +{
>> +	if (unlikely(offset < 0)) {
>> +		chain_block_buckets[0] = next;
>> +		return;
>> +	}
>> +	chain_hlocks[offset] = (next >> 16) | CHAIN_BLK_FLAG;
>> +	chain_hlocks[offset + 1] = next & CHAIN_HLOCKS_MASK;
>> +	if (size > MAX_CHAIN_BUCKETS) {
>> +		chain_hlocks[offset + 2] = size >> 16;
>> +		chain_hlocks[offset + 3] = size & CHAIN_HLOCKS_MASK;
>> +	}
>> +}
> AFAICT HLOCKS_MASK is superfluous. That is, you're assigning to a u16,
> it will truncate automagically.
>
> But if you want to make it more explicit, something like:
>
>   chain_hlocks[offset + 1] = (u16)next;
>
> might be easier to read still.
>
Yes, I am aware that the macro may not be needed. Will make the changes
in the next version.

Thanks,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ