public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] random: kmalloc failure ignored in init_std_data()
Date: Sat, 19 Sep 2009 02:19:35 -0500	[thread overview]
Message-ID: <1253344775.3364.183.camel@calx> (raw)
In-Reply-To: <4AB42BAF.90204@gmail.com>

On Sat, 2009-09-19 at 02:54 +0200, Roel Kluin wrote:
> kmalloc may fail so build the array into the statically allocated
> pool structures instead.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Is this what you had in mind? (it builds)

Yes, looks good.

Acked-by: Matt Mackall <mpm@selenic.com>

> 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)

-- 
http://selenic.com : development and support for Mercurial and Linux



  reply	other threads:[~2009-09-19  7:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 23:03 [PATCH] random: kmalloc failure ignored in init_std_data() Roel Kluin
2009-09-19  0:10 ` Matt Mackall
2009-09-19  0:54   ` Roel Kluin
2009-09-19  7:19     ` Matt Mackall [this message]
2009-10-09  7:35     ` Andrew Morton

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=1253344775.3364.183.camel@calx \
    --to=mpm@selenic.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    /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