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
Reply to
Christophe Leroy, 2024-08-27
On Tue, Aug 27, 2024 at 09:31:48AM +0200, Christophe Leroy wrote:
quoted hunk ↗ jump to hunk
-	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
Thread (21 messages) 21 messages, 5 authors, last reply 2024-08-29
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help