# 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 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2024/08/2723191
- Thread: https://ratatoskr.run/linuxppc-dev/2024/08/2723152/t.md

```text
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

```
