hwrng: Make explicit that max >= 32 always
As hw_random core calls ->read with max > 32 or more, make it explicit. Also remove checks involving 'max' being less than 8. Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:

committed by
Herbert Xu

parent
8ff4c191d1
commit
ed424bb368
@@ -28,7 +28,6 @@
|
||||
static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
|
||||
{
|
||||
u64 buffer[PLPAR_HCALL_BUFSIZE];
|
||||
size_t size = max < 8 ? max : 8;
|
||||
int rc;
|
||||
|
||||
rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer);
|
||||
@@ -36,10 +35,10 @@ static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait
|
||||
pr_err_ratelimited("H_RANDOM call failed %d\n", rc);
|
||||
return -EIO;
|
||||
}
|
||||
memcpy(data, buffer, size);
|
||||
memcpy(data, buffer, 8);
|
||||
|
||||
/* The hypervisor interface returns 64 bits */
|
||||
return size;
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user