Thread (21 messages) 21 messages, 5 authors, 2024-08-29

Re: [PATCH 2/4] random: vDSO: Don't use PAGE_SIZE and PAGE_MASK

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: 2024-08-27 07:50:08
Also in: linux-arch, lkml

On Tue, Aug 27, 2024 at 09:31:48AM +0200, Christophe Leroy wrote:
-	ssize_t ret = min_t(size_t, INT_MAX & PAGE_MASK /* = MAX_RW_COUNT */, len);
+	const unsigned long page_size = 1UL << CONFIG_PAGE_SHIFT;
+	const unsigned long page_mask = ~(page_size - 1);
+	ssize_t ret = min_t(size_t, INT_MAX & page_mask /* = MAX_RW_COUNT */, len);
I'm really not a fan of making the code less idiomatic...
An easy solution would be to define PAGE_SIZE and PAGE_MASK in vDSO
when they do not exist already, but this can be misleading.
Why would what tglx and I suggested be misleading? That seems pretty
normal... Are you worried they might mismatch somehow? (If so, why?) 

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help