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] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AB42BAF.90204@gmail.com>
Date:	Sat, 19 Sep 2009 02:54:07 +0200
From:	Roel Kluin <roel.kluin@...il.com>
To:	Matt Mackall <mpm@...enic.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] random: kmalloc failure ignored in init_std_data()

kmalloc may fail so build the array into the statically allocated
pool structures instead.

Signed-off-by: Roel Kluin <roel.kluin@...il.com>
---
Is this what you had in mind? (it builds)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index d8a9255..9012540 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -400,6 +400,8 @@ module_param(debug, bool, 0644);
  *
  **********************************************************************/
 
+#define EXTRACT_SIZE 10
+
 struct entropy_store;
 struct entropy_store {
 	/* read-only data: */
@@ -414,7 +416,9 @@ struct entropy_store {
 	unsigned add_ptr;
 	int entropy_count;
 	int input_rotate;
-	__u8 *last_data;
+#ifdef CONFIG_CRYPTO_FIPS
+	__u8 last_data[EXTRACT_SIZE];
+#endif
 };
 
 static __u32 input_pool_data[INPUT_POOL_WORDS];
@@ -714,8 +718,6 @@ void add_disk_randomness(struct gendisk *disk)
 }
 #endif
 
-#define EXTRACT_SIZE 10
-
 /*********************************************************************
  *
  * Entropy extraction routines
@@ -951,9 +953,6 @@ static void init_std_data(struct entropy_store *r)
 	now = ktime_get_real();
 	mix_pool_bytes(r, &now, sizeof(now));
 	mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
-	/* Enable continuous test in fips mode */
-	if (fips_enabled)
-		r->last_data = kmalloc(EXTRACT_SIZE, GFP_KERNEL);
 }
 
 static int rand_initialize(void)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ