Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] hw_random: timeriomem-rng: Remove 'max < 4' condition check
@ 2017-08-22 16:22 PrasannaKumar Muralidharan
  2017-08-22 16:53 ` Rick Altherr
  0 siblings, 1 reply; 3+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-08-22 16:22 UTC (permalink / raw)
  To: herbert, raltherr, linux-crypto; +Cc: PrasannaKumar Muralidharan

In read routiene max is always >= 4. The check whether 'max < 4' is not
necessary. Remove it.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
---
 drivers/char/hw_random/timeriomem-rng.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index 03ff548..f615684 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -53,13 +53,6 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
 	int period_us = ktime_to_us(priv->period);
 
 	/*
-	 * The RNG provides 32-bits per read.  Ensure there is enough space for
-	 * at minimum one read.
-	 */
-	if (max < sizeof(u32))
-		return 0;
-
-	/*
 	 * There may not have been enough time for new data to be generated
 	 * since the last request.  If the caller doesn't want to wait, let them
 	 * bail out.  Otherwise, wait for the completion.  If the new data has
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw_random: timeriomem-rng: Remove 'max < 4' condition check
  2017-08-22 16:22 [PATCH] hw_random: timeriomem-rng: Remove 'max < 4' condition check PrasannaKumar Muralidharan
@ 2017-08-22 16:53 ` Rick Altherr
  2017-08-23  3:02   ` PrasannaKumar Muralidharan
  0 siblings, 1 reply; 3+ messages in thread
From: Rick Altherr @ 2017-08-22 16:53 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: Herbert Xu, linux-crypto

On Tue, Aug 22, 2017 at 9:22 AM, PrasannaKumar Muralidharan
<prasannatsmkumar@gmail.com> wrote:
>
> In read routiene max is always >= 4. The check whether 'max < 4' is not
> necessary. Remove it.

Missed that in the header.

Acked-By: Rick Altherr <raltherr@google.com>

>
> Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
> ---
>  drivers/char/hw_random/timeriomem-rng.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
> index 03ff548..f615684 100644
> --- a/drivers/char/hw_random/timeriomem-rng.c
> +++ b/drivers/char/hw_random/timeriomem-rng.c
> @@ -53,13 +53,6 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
>         int period_us = ktime_to_us(priv->period);
>
>         /*
> -        * The RNG provides 32-bits per read.  Ensure there is enough space for
> -        * at minimum one read.
> -        */
> -       if (max < sizeof(u32))
> -               return 0;
> -
> -       /*
>          * There may not have been enough time for new data to be generated
>          * since the last request.  If the caller doesn't want to wait, let them
>          * bail out.  Otherwise, wait for the completion.  If the new data has
> --
> 2.10.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw_random: timeriomem-rng: Remove 'max < 4' condition check
  2017-08-22 16:53 ` Rick Altherr
@ 2017-08-23  3:02   ` PrasannaKumar Muralidharan
  0 siblings, 0 replies; 3+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-08-23  3:02 UTC (permalink / raw)
  To: Rick Altherr; +Cc: Herbert Xu, linux-crypto

Hi Rick,

On 22 August 2017 at 22:23, Rick Altherr <raltherr@google.com> wrote:
> On Tue, Aug 22, 2017 at 9:22 AM, PrasannaKumar Muralidharan
> <prasannatsmkumar@gmail.com> wrote:
>>
>> In read routiene max is always >= 4. The check whether 'max < 4' is not
>> necessary. Remove it.
>
> Missed that in the header.

It was added recently so you could have not missed it.

>
> Acked-By: Rick Altherr <raltherr@google.com>
>
>>
>> Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
>> ---
>>  drivers/char/hw_random/timeriomem-rng.c | 7 -------
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
>> index 03ff548..f615684 100644
>> --- a/drivers/char/hw_random/timeriomem-rng.c
>> +++ b/drivers/char/hw_random/timeriomem-rng.c
>> @@ -53,13 +53,6 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
>>         int period_us = ktime_to_us(priv->period);
>>
>>         /*
>> -        * The RNG provides 32-bits per read.  Ensure there is enough space for
>> -        * at minimum one read.
>> -        */
>> -       if (max < sizeof(u32))
>> -               return 0;
>> -
>> -       /*
>>          * There may not have been enough time for new data to be generated
>>          * since the last request.  If the caller doesn't want to wait, let them
>>          * bail out.  Otherwise, wait for the completion.  If the new data has
>> --
>> 2.10.0
>>

Regards,
PrasannaKumar

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-23  3:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 16:22 [PATCH] hw_random: timeriomem-rng: Remove 'max < 4' condition check PrasannaKumar Muralidharan
2017-08-22 16:53 ` Rick Altherr
2017-08-23  3:02   ` PrasannaKumar Muralidharan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox