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]
Message-ID: <41f8b0d0-0ef6-4883-bbad-52e77b13700b@nvidia.com>
Date: Mon, 21 Oct 2024 12:51:44 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Alice Ryhl <alice@...l.io>, Alice Ryhl <aliceryhl@...gle.com>
CC: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Miguel Ojeda
	<ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, "Matthew
 Wilcox (Oracle)" <willy@...radead.org>, Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin
	<benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, "Trevor
 Gross" <tmgross@...ch.edu>, <linux-mm@...ck.org>,
	<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] rust: page: add Rust version of PAGE_ALIGN

On 10/21/24 12:49 PM, Alice Ryhl wrote:
> On 10/21/24 9:34 PM, John Hubbard wrote:
>> On 10/21/24 12:26 PM, Alice Ryhl wrote:
>>> On Mon, Oct 21, 2024 at 9:09 PM John Hubbard <jhubbard@...dia.com> wrote:
...
>>> Rust macros can use different types of brackets. For example, the
>>> `assert!(1 < 2)` macro uses round parenthesises, the `vec![1,2,3]`
>>> macro uses square parenthesises, and the `thread_local! { ... }` macro
>>> uses curly parenthesies. The round and square brackets are used for
>>> expression-like things, and the curlies are used for things that
>>> expand to top-level items such as global variables or functions.
>>>
>>> Macros cannot use any other delimiter than those three. So e.g. <>
>>> wouldn't work.
>>
>> That answers my implicit "are there any cases in which you would
>> want to collectively refer to all three types of...bracket?", yes.
>>
>> For the original point, though, we are not in a Rust macro. Is it
>> actually allowable to use [] or {} here:
>>
>> +    // Brackets around PAGE_SIZE-1 to avoid triggering overflow sanitizers in the wrong cases.
>> +    (addr + (PAGE_SIZE - 1)) & PAGE_MASK
>>
>> ? Is that why you were not seeing a difference between saying "brackets"
>> vs. "parentheses" there? If so, this would be yet another case of my
>> Rust newbie-ness being inflicted on you. :)
> You can use both () and {}, but you can only use brackets if you're European. ;)

I *knew* I was missing out! hahaha

> 
> Using {} to create a block works because a block evaluates to the value of the last expression in the block. It would be super weird to define a block here, though.
> 

No argument there. :)

thanks,
-- 
John Hubbard


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ