linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH 5.15 033/145] random: selectively clang-format where it makes sense
Date: Fri, 27 May 2022 10:48:54 +0200	[thread overview]
Message-ID: <20220527084854.857966209@linuxfoundation.org> (raw)
In-Reply-To: <20220527084850.364560116@linuxfoundation.org>

From: "Jason A. Donenfeld" <Jason@zx2c4.com>

commit 248045b8dea5a32ddc0aa44193d6bc70c4b9cd8e upstream.

This is an old driver that has seen a lot of different eras of kernel
coding style. In an effort to make it easier to code for, unify the
coding style around the current norm, by accepting some of -- but
certainly not all of -- the suggestions from clang-format. This should
remove ambiguity in coding style, especially with regards to spacing,
when code is being changed or amended. Consequently it also makes code
review easier on the eyes, following one uniform style rather than
several.

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/char/random.c |  209 +++++++++++++++++++++++---------------------------
 1 file changed, 99 insertions(+), 110 deletions(-)

--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -124,7 +124,7 @@
  *
  * The primary kernel interface is
  *
- * 	void get_random_bytes(void *buf, int nbytes);
+ *	void get_random_bytes(void *buf, int nbytes);
  *
  * This interface will return the requested number of random bytes,
  * and place it in the requested buffer.  This is equivalent to a
@@ -132,10 +132,10 @@
  *
  * For less critical applications, there are the functions:
  *
- * 	u32 get_random_u32()
- * 	u64 get_random_u64()
- * 	unsigned int get_random_int()
- * 	unsigned long get_random_long()
+ *	u32 get_random_u32()
+ *	u64 get_random_u64()
+ *	unsigned int get_random_int()
+ *	unsigned long get_random_long()
  *
  * These are produced by a cryptographic RNG seeded from get_random_bytes,
  * and so do not deplete the entropy pool as much.  These are recommended
@@ -197,10 +197,10 @@
  * from the devices are:
  *
  *	void add_device_randomness(const void *buf, unsigned int size);
- * 	void add_input_randomness(unsigned int type, unsigned int code,
+ *	void add_input_randomness(unsigned int type, unsigned int code,
  *                                unsigned int value);
  *	void add_interrupt_randomness(int irq);
- * 	void add_disk_randomness(struct gendisk *disk);
+ *	void add_disk_randomness(struct gendisk *disk);
  *	void add_hwgenerator_randomness(const char *buffer, size_t count,
  *					size_t entropy);
  *	void add_bootloader_randomness(const void *buf, unsigned int size);
@@ -296,8 +296,8 @@
  * /dev/random and /dev/urandom created already, they can be created
  * by using the commands:
  *
- * 	mknod /dev/random c 1 8
- * 	mknod /dev/urandom c 1 9
+ *	mknod /dev/random c 1 8
+ *	mknod /dev/urandom c 1 9
  *
  * Acknowledgements:
  * =================
@@ -443,9 +443,9 @@ static DEFINE_SPINLOCK(random_ready_list
 static LIST_HEAD(random_ready_list);
 
 struct crng_state {
-	u32		state[16];
-	unsigned long	init_time;
-	spinlock_t	lock;
+	u32 state[16];
+	unsigned long init_time;
+	spinlock_t lock;
 };
 
 static struct crng_state primary_crng = {
@@ -469,7 +469,7 @@ static bool crng_need_final_init = false
 #define crng_ready() (likely(crng_init > 1))
 static int crng_init_cnt = 0;
 static unsigned long crng_global_init_time = 0;
-#define CRNG_INIT_CNT_THRESH (2*CHACHA_KEY_SIZE)
+#define CRNG_INIT_CNT_THRESH (2 * CHACHA_KEY_SIZE)
 static void _extract_crng(struct crng_state *crng, u8 out[CHACHA_BLOCK_SIZE]);
 static void _crng_backtrack_protect(struct crng_state *crng,
 				    u8 tmp[CHACHA_BLOCK_SIZE], int used);
@@ -509,7 +509,7 @@ static ssize_t _extract_entropy(void *bu
 
 static void crng_reseed(struct crng_state *crng, bool use_input_pool);
 
-static u32 const twist_table[8] = {
+static const u32 twist_table[8] = {
 	0x00000000, 0x3b6e20c8, 0x76dc4190, 0x4db26158,
 	0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 };
 
@@ -579,10 +579,10 @@ static void mix_pool_bytes(const void *i
 }
 
 struct fast_pool {
-	u32		pool[4];
-	unsigned long	last;
-	u16		reg_idx;
-	u8		count;
+	u32 pool[4];
+	unsigned long last;
+	u16 reg_idx;
+	u8 count;
 };
 
 /*
@@ -710,7 +710,7 @@ static int credit_entropy_bits_safe(int
 		return -EINVAL;
 
 	/* Cap the value to avoid overflows */
-	nbits = min(nbits,  POOL_BITS);
+	nbits = min(nbits, POOL_BITS);
 
 	credit_entropy_bits(nbits);
 	return 0;
@@ -722,7 +722,7 @@ static int credit_entropy_bits_safe(int
  *
  *********************************************************************/
 
-#define CRNG_RESEED_INTERVAL (300*HZ)
+#define CRNG_RESEED_INTERVAL (300 * HZ)
 
 static DECLARE_WAIT_QUEUE_HEAD(crng_init_wait);
 
@@ -746,9 +746,9 @@ early_param("random.trust_cpu", parse_tr
 
 static bool crng_init_try_arch(struct crng_state *crng)
 {
-	int		i;
-	bool		arch_init = true;
-	unsigned long	rv;
+	int i;
+	bool arch_init = true;
+	unsigned long rv;
 
 	for (i = 4; i < 16; i++) {
 		if (!arch_get_random_seed_long(&rv) &&
@@ -764,9 +764,9 @@ static bool crng_init_try_arch(struct cr
 
 static bool __init crng_init_try_arch_early(struct crng_state *crng)
 {
-	int		i;
-	bool		arch_init = true;
-	unsigned long	rv;
+	int i;
+	bool arch_init = true;
+	unsigned long rv;
 
 	for (i = 4; i < 16; i++) {
 		if (!arch_get_random_seed_long_early(&rv) &&
@@ -836,7 +836,7 @@ static void do_numa_crng_init(struct wor
 	struct crng_state *crng;
 	struct crng_state **pool;
 
-	pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
+	pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL | __GFP_NOFAIL);
 	for_each_online_node(i) {
 		crng = kmalloc_node(sizeof(struct crng_state),
 				    GFP_KERNEL | __GFP_NOFAIL, i);
@@ -892,7 +892,7 @@ static size_t crng_fast_load(const u8 *c
 		spin_unlock_irqrestore(&primary_crng.lock, flags);
 		return 0;
 	}
-	p = (u8 *) &primary_crng.state[4];
+	p = (u8 *)&primary_crng.state[4];
 	while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) {
 		p[crng_init_cnt % CHACHA_KEY_SIZE] ^= *cp;
 		cp++; crng_init_cnt++; len--; ret++;
@@ -922,12 +922,12 @@ static size_t crng_fast_load(const u8 *c
  */
 static int crng_slow_load(const u8 *cp, size_t len)
 {
-	unsigned long		flags;
-	static u8		lfsr = 1;
-	u8			tmp;
-	unsigned int		i, max = CHACHA_KEY_SIZE;
-	const u8 *		src_buf = cp;
-	u8 *			dest_buf = (u8 *) &primary_crng.state[4];
+	unsigned long flags;
+	static u8 lfsr = 1;
+	u8 tmp;
+	unsigned int i, max = CHACHA_KEY_SIZE;
+	const u8 *src_buf = cp;
+	u8 *dest_buf = (u8 *)&primary_crng.state[4];
 
 	if (!spin_trylock_irqsave(&primary_crng.lock, flags))
 		return 0;
@@ -938,7 +938,7 @@ static int crng_slow_load(const u8 *cp,
 	if (len > max)
 		max = len;
 
-	for (i = 0; i < max ; i++) {
+	for (i = 0; i < max; i++) {
 		tmp = lfsr;
 		lfsr >>= 1;
 		if (tmp & 1)
@@ -953,11 +953,11 @@ static int crng_slow_load(const u8 *cp,
 
 static void crng_reseed(struct crng_state *crng, bool use_input_pool)
 {
-	unsigned long	flags;
-	int		i, num;
+	unsigned long flags;
+	int i, num;
 	union {
-		u8	block[CHACHA_BLOCK_SIZE];
-		u32	key[8];
+		u8 block[CHACHA_BLOCK_SIZE];
+		u32 key[8];
 	} buf;
 
 	if (use_input_pool) {
@@ -971,11 +971,11 @@ static void crng_reseed(struct crng_stat
 	}
 	spin_lock_irqsave(&crng->lock, flags);
 	for (i = 0; i < 8; i++) {
-		unsigned long	rv;
+		unsigned long rv;
 		if (!arch_get_random_seed_long(&rv) &&
 		    !arch_get_random_long(&rv))
 			rv = random_get_entropy();
-		crng->state[i+4] ^= buf.key[i] ^ rv;
+		crng->state[i + 4] ^= buf.key[i] ^ rv;
 	}
 	memzero_explicit(&buf, sizeof(buf));
 	WRITE_ONCE(crng->init_time, jiffies);
@@ -983,8 +983,7 @@ static void crng_reseed(struct crng_stat
 	crng_finalize_init(crng);
 }
 
-static void _extract_crng(struct crng_state *crng,
-			  u8 out[CHACHA_BLOCK_SIZE])
+static void _extract_crng(struct crng_state *crng, u8 out[CHACHA_BLOCK_SIZE])
 {
 	unsigned long flags, init_time;
 
@@ -1013,9 +1012,9 @@ static void extract_crng(u8 out[CHACHA_B
 static void _crng_backtrack_protect(struct crng_state *crng,
 				    u8 tmp[CHACHA_BLOCK_SIZE], int used)
 {
-	unsigned long	flags;
-	u32		*s, *d;
-	int		i;
+	unsigned long flags;
+	u32 *s, *d;
+	int i;
 
 	used = round_up(used, sizeof(u32));
 	if (used + CHACHA_KEY_SIZE > CHACHA_BLOCK_SIZE) {
@@ -1023,9 +1022,9 @@ static void _crng_backtrack_protect(stru
 		used = 0;
 	}
 	spin_lock_irqsave(&crng->lock, flags);
-	s = (u32 *) &tmp[used];
+	s = (u32 *)&tmp[used];
 	d = &crng->state[4];
-	for (i=0; i < 8; i++)
+	for (i = 0; i < 8; i++)
 		*d++ ^= *s++;
 	spin_unlock_irqrestore(&crng->lock, flags);
 }
@@ -1070,7 +1069,6 @@ static ssize_t extract_crng_user(void __
 	return ret;
 }
 
-
 /*********************************************************************
  *
  * Entropy input management
@@ -1165,11 +1163,11 @@ static void add_timer_randomness(struct
 	 * Round down by 1 bit on general principles,
 	 * and limit entropy estimate to 12 bits.
 	 */
-	credit_entropy_bits(min_t(int, fls(delta>>1), 11));
+	credit_entropy_bits(min_t(int, fls(delta >> 1), 11));
 }
 
 void add_input_randomness(unsigned int type, unsigned int code,
-				 unsigned int value)
+			  unsigned int value)
 {
 	static unsigned char last_value;
 
@@ -1189,19 +1187,19 @@ static DEFINE_PER_CPU(struct fast_pool,
 #ifdef ADD_INTERRUPT_BENCH
 static unsigned long avg_cycles, avg_deviation;
 
-#define AVG_SHIFT 8     /* Exponential average factor k=1/256 */
-#define FIXED_1_2 (1 << (AVG_SHIFT-1))
+#define AVG_SHIFT 8 /* Exponential average factor k=1/256 */
+#define FIXED_1_2 (1 << (AVG_SHIFT - 1))
 
 static void add_interrupt_bench(cycles_t start)
 {
-        long delta = random_get_entropy() - start;
+	long delta = random_get_entropy() - start;
 
-        /* Use a weighted moving average */
-        delta = delta - ((avg_cycles + FIXED_1_2) >> AVG_SHIFT);
-        avg_cycles += delta;
-        /* And average deviation */
-        delta = abs(delta) - ((avg_deviation + FIXED_1_2) >> AVG_SHIFT);
-        avg_deviation += delta;
+	/* Use a weighted moving average */
+	delta = delta - ((avg_cycles + FIXED_1_2) >> AVG_SHIFT);
+	avg_cycles += delta;
+	/* And average deviation */
+	delta = abs(delta) - ((avg_deviation + FIXED_1_2) >> AVG_SHIFT);
+	avg_deviation += delta;
 }
 #else
 #define add_interrupt_bench(x)
@@ -1209,7 +1207,7 @@ static void add_interrupt_bench(cycles_t
 
 static u32 get_reg(struct fast_pool *f, struct pt_regs *regs)
 {
-	u32 *ptr = (u32 *) regs;
+	u32 *ptr = (u32 *)regs;
 	unsigned int idx;
 
 	if (regs == NULL)
@@ -1224,12 +1222,12 @@ static u32 get_reg(struct fast_pool *f,
 
 void add_interrupt_randomness(int irq)
 {
-	struct fast_pool	*fast_pool = this_cpu_ptr(&irq_randomness);
-	struct pt_regs		*regs = get_irq_regs();
-	unsigned long		now = jiffies;
-	cycles_t		cycles = random_get_entropy();
-	u32			c_high, j_high;
-	u64			ip;
+	struct fast_pool *fast_pool = this_cpu_ptr(&irq_randomness);
+	struct pt_regs *regs = get_irq_regs();
+	unsigned long now = jiffies;
+	cycles_t cycles = random_get_entropy();
+	u32 c_high, j_high;
+	u64 ip;
 
 	if (cycles == 0)
 		cycles = get_reg(fast_pool, regs);
@@ -1239,8 +1237,8 @@ void add_interrupt_randomness(int irq)
 	fast_pool->pool[1] ^= now ^ c_high;
 	ip = regs ? instruction_pointer(regs) : _RET_IP_;
 	fast_pool->pool[2] ^= ip;
-	fast_pool->pool[3] ^= (sizeof(ip) > 4) ? ip >> 32 :
-		get_reg(fast_pool, regs);
+	fast_pool->pool[3] ^=
+		(sizeof(ip) > 4) ? ip >> 32 : get_reg(fast_pool, regs);
 
 	fast_mix(fast_pool);
 	add_interrupt_bench(cycles);
@@ -1254,8 +1252,7 @@ void add_interrupt_randomness(int irq)
 		return;
 	}
 
-	if ((fast_pool->count < 64) &&
-	    !time_after(now, fast_pool->last + HZ))
+	if ((fast_pool->count < 64) && !time_after(now, fast_pool->last + HZ))
 		return;
 
 	if (!spin_trylock(&input_pool.lock))
@@ -1319,7 +1316,7 @@ retry:
 		entropy_count = 0;
 	}
 	nfrac = ibytes << (POOL_ENTROPY_SHIFT + 3);
-	if ((size_t) entropy_count > nfrac)
+	if ((size_t)entropy_count > nfrac)
 		entropy_count -= nfrac;
 	else
 		entropy_count = 0;
@@ -1422,10 +1419,9 @@ static ssize_t extract_entropy(void *buf
 }
 
 #define warn_unseeded_randomness(previous) \
-	_warn_unseeded_randomness(__func__, (void *) _RET_IP_, (previous))
+	_warn_unseeded_randomness(__func__, (void *)_RET_IP_, (previous))
 
-static void _warn_unseeded_randomness(const char *func_name, void *caller,
-				      void **previous)
+static void _warn_unseeded_randomness(const char *func_name, void *caller, void **previous)
 {
 #ifdef CONFIG_WARN_ALL_UNSEEDED_RANDOM
 	const bool print_once = false;
@@ -1433,8 +1429,7 @@ static void _warn_unseeded_randomness(co
 	static bool print_once __read_mostly;
 #endif
 
-	if (print_once ||
-	    crng_ready() ||
+	if (print_once || crng_ready() ||
 	    (previous && (caller == READ_ONCE(*previous))))
 		return;
 	WRITE_ONCE(*previous, caller);
@@ -1442,9 +1437,8 @@ static void _warn_unseeded_randomness(co
 	print_once = true;
 #endif
 	if (__ratelimit(&unseeded_warning))
-		printk_deferred(KERN_NOTICE "random: %s called from %pS "
-				"with crng_init=%d\n", func_name, caller,
-				crng_init);
+		printk_deferred(KERN_NOTICE "random: %s called from %pS with crng_init=%d\n",
+				func_name, caller, crng_init);
 }
 
 /*
@@ -1487,7 +1481,6 @@ void get_random_bytes(void *buf, int nby
 }
 EXPORT_SYMBOL(get_random_bytes);
 
-
 /*
  * Each time the timer fires, we expect that we got an unpredictable
  * jump in the cycle counter. Even if the timer is running on another
@@ -1526,7 +1519,7 @@ static void try_to_generate_entropy(void
 	timer_setup_on_stack(&stack.timer, entropy_timer, 0);
 	while (!crng_ready()) {
 		if (!timer_pending(&stack.timer))
-			mod_timer(&stack.timer, jiffies+1);
+			mod_timer(&stack.timer, jiffies + 1);
 		mix_pool_bytes(&stack.now, sizeof(stack.now));
 		schedule();
 		stack.now = random_get_entropy();
@@ -1736,9 +1729,8 @@ void rand_initialize_disk(struct gendisk
 }
 #endif
 
-static ssize_t
-urandom_read_nowarn(struct file *file, char __user *buf, size_t nbytes,
-		    loff_t *ppos)
+static ssize_t urandom_read_nowarn(struct file *file, char __user *buf,
+				   size_t nbytes, loff_t *ppos)
 {
 	int ret;
 
@@ -1748,8 +1740,8 @@ urandom_read_nowarn(struct file *file, c
 	return ret;
 }
 
-static ssize_t
-urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
+static ssize_t urandom_read(struct file *file, char __user *buf, size_t nbytes,
+			    loff_t *ppos)
 {
 	static int maxwarn = 10;
 
@@ -1763,8 +1755,8 @@ urandom_read(struct file *file, char __u
 	return urandom_read_nowarn(file, buf, nbytes, ppos);
 }
 
-static ssize_t
-random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
+static ssize_t random_read(struct file *file, char __user *buf, size_t nbytes,
+			   loff_t *ppos)
 {
 	int ret;
 
@@ -1774,8 +1766,7 @@ random_read(struct file *file, char __us
 	return urandom_read_nowarn(file, buf, nbytes, ppos);
 }
 
-static __poll_t
-random_poll(struct file *file, poll_table * wait)
+static __poll_t random_poll(struct file *file, poll_table *wait)
 {
 	__poll_t mask;
 
@@ -1789,8 +1780,7 @@ random_poll(struct file *file, poll_tabl
 	return mask;
 }
 
-static int
-write_pool(const char __user *buffer, size_t count)
+static int write_pool(const char __user *buffer, size_t count)
 {
 	size_t bytes;
 	u32 t, buf[16];
@@ -1895,9 +1885,9 @@ static int random_fasync(int fd, struct
 }
 
 const struct file_operations random_fops = {
-	.read  = random_read,
+	.read = random_read,
 	.write = random_write,
-	.poll  = random_poll,
+	.poll = random_poll,
 	.unlocked_ioctl = random_ioctl,
 	.compat_ioctl = compat_ptr_ioctl,
 	.fasync = random_fasync,
@@ -1905,7 +1895,7 @@ const struct file_operations random_fops
 };
 
 const struct file_operations urandom_fops = {
-	.read  = urandom_read,
+	.read = urandom_read,
 	.write = random_write,
 	.unlocked_ioctl = random_ioctl,
 	.compat_ioctl = compat_ptr_ioctl,
@@ -1913,19 +1903,19 @@ const struct file_operations urandom_fop
 	.llseek = noop_llseek,
 };
 
-SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count,
-		unsigned int, flags)
+SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, unsigned int,
+		flags)
 {
 	int ret;
 
-	if (flags & ~(GRND_NONBLOCK|GRND_RANDOM|GRND_INSECURE))
+	if (flags & ~(GRND_NONBLOCK | GRND_RANDOM | GRND_INSECURE))
 		return -EINVAL;
 
 	/*
 	 * Requesting insecure and blocking randomness at the same time makes
 	 * no sense.
 	 */
-	if ((flags & (GRND_INSECURE|GRND_RANDOM)) == (GRND_INSECURE|GRND_RANDOM))
+	if ((flags & (GRND_INSECURE | GRND_RANDOM)) == (GRND_INSECURE | GRND_RANDOM))
 		return -EINVAL;
 
 	if (count > INT_MAX)
@@ -1965,8 +1955,8 @@ static char sysctl_bootid[16];
  * returned as an ASCII string in the standard UUID format; if via the
  * sysctl system call, as 16 bytes of binary data.
  */
-static int proc_do_uuid(struct ctl_table *table, int write,
-			void *buffer, size_t *lenp, loff_t *ppos)
+static int proc_do_uuid(struct ctl_table *table, int write, void *buffer,
+			size_t *lenp, loff_t *ppos)
 {
 	struct ctl_table fake_table;
 	unsigned char buf[64], tmp_uuid[16], *uuid;
@@ -1995,8 +1985,8 @@ static int proc_do_uuid(struct ctl_table
 /*
  * Return entropy available scaled to integral bits
  */
-static int proc_do_entropy(struct ctl_table *table, int write,
-			   void *buffer, size_t *lenp, loff_t *ppos)
+static int proc_do_entropy(struct ctl_table *table, int write, void *buffer,
+			   size_t *lenp, loff_t *ppos)
 {
 	struct ctl_table fake_table;
 	int entropy_count;
@@ -2073,7 +2063,7 @@ struct ctl_table random_table[] = {
 #endif
 	{ }
 };
-#endif 	/* CONFIG_SYSCTL */
+#endif	/* CONFIG_SYSCTL */
 
 struct batched_entropy {
 	union {
@@ -2093,7 +2083,7 @@ struct batched_entropy {
  * point prior.
  */
 static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64) = {
-	.batch_lock	= __SPIN_LOCK_UNLOCKED(batched_entropy_u64.lock),
+	.batch_lock = __SPIN_LOCK_UNLOCKED(batched_entropy_u64.lock),
 };
 
 u64 get_random_u64(void)
@@ -2118,7 +2108,7 @@ u64 get_random_u64(void)
 EXPORT_SYMBOL(get_random_u64);
 
 static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32) = {
-	.batch_lock	= __SPIN_LOCK_UNLOCKED(batched_entropy_u32.lock),
+	.batch_lock = __SPIN_LOCK_UNLOCKED(batched_entropy_u32.lock),
 };
 u32 get_random_u32(void)
 {
@@ -2150,7 +2140,7 @@ static void invalidate_batched_entropy(v
 	int cpu;
 	unsigned long flags;
 
-	for_each_possible_cpu (cpu) {
+	for_each_possible_cpu(cpu) {
 		struct batched_entropy *batched_entropy;
 
 		batched_entropy = per_cpu_ptr(&batched_entropy_u32, cpu);
@@ -2179,8 +2169,7 @@ static void invalidate_batched_entropy(v
  * Return: A page aligned address within [start, start + range).  On error,
  * @start is returned.
  */
-unsigned long
-randomize_page(unsigned long start, unsigned long range)
+unsigned long randomize_page(unsigned long start, unsigned long range)
 {
 	if (!PAGE_ALIGNED(start)) {
 		range -= PAGE_ALIGN(start) - start;



  parent reply	other threads:[~2022-05-27 11:51 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  8:48 [PATCH 5.15 000/145] 5.15.44-rc1 review Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 001/145] HID: amd_sfh: Add support for sensor discovery Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 002/145] KVM: x86/mmu: fix NULL pointer dereference on guest INVPCID Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 003/145] [PATCH 5.15] ice: fix crash at allocation failure Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 004/145] ACPI: sysfs: Fix BERT error region memory mapping Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 005/145] MAINTAINERS: co-maintain random.c Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 006/145] MAINTAINERS: add git tree for random.c Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 007/145] lib/crypto: blake2s: include as built-in Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 008/145] lib/crypto: blake2s: move hmac construction into wireguard Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 009/145] lib/crypto: sha1: re-roll loops to reduce code size Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 010/145] lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 011/145] random: document add_hwgenerator_randomness() with other input functions Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 012/145] random: remove unused irq_flags argument from add_interrupt_randomness() Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 013/145] random: use BLAKE2s instead of SHA1 in extraction Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 014/145] random: do not sign extend bytes for rotation when mixing Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 015/145] random: do not re-init if crng_reseed completes before primary init Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 016/145] random: mix bootloader randomness into pool Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 017/145] random: harmonize "crng init done" messages Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 018/145] random: use IS_ENABLED(CONFIG_NUMA) instead of ifdefs Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 019/145] random: early initialization of ChaCha constants Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 020/145] random: avoid superfluous call to RDRAND in CRNG extraction Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 021/145] random: dont reset crng_init_cnt on urandom_read() Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 022/145] random: fix typo in comments Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 023/145] random: cleanup poolinfo abstraction Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 024/145] random: cleanup integer types Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 025/145] random: remove incomplete last_data logic Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 026/145] random: remove unused extract_entropy() reserved argument Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 027/145] random: rather than entropy_store abstraction, use global Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 028/145] random: remove unused OUTPUT_POOL constants Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 029/145] random: de-duplicate INPUT_POOL constants Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 030/145] random: prepend remaining pool constants with POOL_ Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 031/145] random: cleanup fractional entropy shift constants Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 032/145] random: access input_pool_data directly rather than through pointer Greg Kroah-Hartman
2022-05-27  8:48 ` Greg Kroah-Hartman [this message]
2022-05-27  8:48 ` [PATCH 5.15 034/145] random: simplify arithmetic function flow in account() Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 035/145] random: continually use hwgenerator randomness Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 036/145] random: access primary_pool directly rather than through pointer Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 037/145] random: only call crng_finalize_init() for primary_crng Greg Kroah-Hartman
2022-05-27  8:48 ` [PATCH 5.15 038/145] random: use computational hash for entropy extraction Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 039/145] random: simplify entropy debiting Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 040/145] random: use linear min-entropy accumulation crediting Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 041/145] random: always wake up entropy writers after extraction Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 042/145] random: make credit_entropy_bits() always safe Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 043/145] random: remove use_input_pool parameter from crng_reseed() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 044/145] random: remove batched entropy locking Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 045/145] random: fix locking in crng_fast_load() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 046/145] random: use RDSEED instead of RDRAND in entropy extraction Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 047/145] random: get rid of secondary crngs Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 048/145] random: inline leaves of rand_initialize() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 049/145] random: ensure early RDSEED goes through mixer on init Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 050/145] random: do not xor RDRAND when writing into /dev/random Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 051/145] random: absorb fast pool into input pool after fast load Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 052/145] random: use simpler fast key erasure flow on per-cpu keys Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 053/145] random: use hash function for crng_slow_load() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 054/145] random: make more consistent use of integer types Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 055/145] random: remove outdated INT_MAX >> 6 check in urandom_read() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 056/145] random: zero buffer after reading entropy from userspace Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 057/145] random: fix locking for crng_init in crng_reseed() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 058/145] random: tie batched entropy generation to base_crng generation Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 059/145] random: remove ifdefd out interrupt bench Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 060/145] random: remove unused tracepoints Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 061/145] random: add proper SPDX header Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 062/145] random: deobfuscate irq u32/u64 contributions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 063/145] random: introduce drain_entropy() helper to declutter crng_reseed() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 064/145] random: remove useless header comment Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 065/145] random: remove whitespace and reorder includes Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 066/145] random: group initialization wait functions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 067/145] random: group crng functions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 068/145] random: group entropy extraction functions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 069/145] random: group entropy collection functions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 070/145] random: group userspace read/write functions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 071/145] random: group sysctl functions Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 072/145] random: rewrite header introductory comment Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 073/145] random: defer fast pool mixing to worker Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 074/145] random: do not take pool spinlock at boot Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 075/145] random: unify early init crng load accounting Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 076/145] random: check for crng_init == 0 in add_device_randomness() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 077/145] random: pull add_hwgenerator_randomness() declaration into random.h Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 078/145] random: clear fast pool, crng, and batches in cpuhp bring up Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 079/145] random: round-robin registers as ulong, not u32 Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 080/145] random: only wake up writers after zap if threshold was passed Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 081/145] random: cleanup UUID handling Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 082/145] random: unify cycles_t and jiffies usage and types Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 083/145] random: do crng pre-init loading in worker rather than irq Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 084/145] random: give sysctl_random_min_urandom_seed a more sensible value Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 085/145] random: dont let 644 read-only sysctls be written to Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 086/145] random: replace custom notifier chain with standard one Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 087/145] random: use SipHash as interrupt entropy accumulator Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 088/145] random: make consistent usage of crng_ready() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 089/145] random: reseed more often immediately after booting Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 090/145] random: check for signal and try earlier when generating entropy Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 091/145] random: skip fast_init if hwrng provides large chunk of entropy Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 092/145] random: treat bootloader trust toggle the same way as cpu trust toggle Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 093/145] random: re-add removed comment about get_random_{u32,u64} reseeding Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 094/145] random: mix build-time latent entropy into pool at init Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 095/145] random: do not split fast init input in add_hwgenerator_randomness() Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 096/145] random: do not allow user to keep crng key around on stack Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 097/145] random: check for signal_pending() outside of need_resched() check Greg Kroah-Hartman
2022-05-27  8:49 ` [PATCH 5.15 098/145] random: check for signals every PAGE_SIZE chunk of /dev/[u]random Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 099/145] random: allow partial reads if later user copies fail Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 100/145] random: make random_get_entropy() return an unsigned long Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 101/145] random: document crng_fast_key_erasure() destination possibility Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 102/145] random: fix sysctl documentation nits Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 103/145] init: call time_init() before rand_initialize() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 104/145] ia64: define get_cycles macro for arch-override Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 105/145] s390: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 106/145] parisc: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 107/145] alpha: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 108/145] powerpc: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 109/145] timekeeping: Add raw clock fallback for random_get_entropy() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 110/145] m68k: use fallback for random_get_entropy() instead of zero Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 111/145] riscv: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 112/145] mips: use fallback for random_get_entropy() instead of just c0 random Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 113/145] arm: use fallback for random_get_entropy() instead of zero Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 114/145] nios2: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 115/145] x86/tsc: Use " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 116/145] um: use " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 117/145] sparc: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 118/145] xtensa: " Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 119/145] random: insist on random_get_entropy() existing in order to simplify Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 120/145] random: do not use batches when !crng_ready() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 121/145] random: use first 128 bits of input as fast init Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 122/145] random: do not pretend to handle premature next security model Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 123/145] random: order timer entropy functions below interrupt functions Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 124/145] random: do not use input pool from hard IRQs Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 125/145] random: help compiler out with fast_mix() by using simpler arguments Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 126/145] siphash: use one source of truth for siphash permutations Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 127/145] random: use symbolic constants for crng_init states Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 128/145] random: avoid initializing twice in credit race Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 129/145] random: move initialization out of reseeding hot path Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 130/145] random: remove ratelimiting for in-kernel unseeded randomness Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 131/145] random: use proper jiffies comparison macro Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 132/145] random: handle latent entropy and command line from random_init() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 133/145] random: credit architectural init the exact amount Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 134/145] random: use static branch for crng_ready() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 135/145] random: remove extern from functions in header Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 136/145] random: use proper return types on get_random_{int,long}_wait() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 137/145] random: make consistent use of buf and len Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 138/145] random: move initialization functions out of hot pages Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 139/145] random: move randomize_page() into mm where it belongs Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 140/145] random: unify batched entropy implementations Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 141/145] random: convert to using fops->read_iter() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 142/145] random: convert to using fops->write_iter() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 143/145] random: wire up fops->splice_{read,write}_iter() Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 144/145] random: check for signals after page of pool writes Greg Kroah-Hartman
2022-05-27  8:50 ` [PATCH 5.15 145/145] ALSA: ctxfi: Add SB046x PCI ID Greg Kroah-Hartman
2022-05-27 22:39 ` [PATCH 5.15 000/145] 5.15.44-rc1 review Guenter Roeck
2022-05-28  6:29 ` Bagas Sanjaya
2022-05-28 10:52 ` Naresh Kamboju
2022-05-28 15:27 ` Sudip Mukherjee
2022-05-28 21:08 ` Ron Economos
2022-05-29  0:35 ` Fox Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527084854.857966209@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).