aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hw_random/timeriomem-rng.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2019-08-31 13:55:55 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2019-09-05 14:37:30 +1000
commit2a4bfd023fa97c70006ab368c30c0bf84d0e905d (patch)
tree4280283da8579abf3bcb795b0df477654c7a3cfc /drivers/char/hw_random/timeriomem-rng.c
parentcrypto: inside-secure - Added support for basic AES-CCM (diff)
downloadlinux-dev-2a4bfd023fa97c70006ab368c30c0bf84d0e905d.tar.xz
linux-dev-2a4bfd023fa97c70006ab368c30c0bf84d0e905d.zip
hwrng: timeriomem - relax check on memory resource size
The timeriomem_rng driver only accesses the first 4 bytes of the given memory area and currently, it also forces that memory resource to be exactly 4 bytes in size. This, however, is problematic when used with device-trees that are generated from things like FPGA toolchains, where the minimum size of an exposed memory block may be something like 4k. Hence, let's only check for what's needed for the driver to operate properly; namely that we have enough memory available to read the random data from. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--drivers/char/hw_random/timeriomem-rng.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index ccd1f6e0696b..e262445fed5f 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -117,9 +117,9 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
if (!res)
return -ENXIO;
- if (res->start % 4 != 0 || resource_size(res) != 4) {
+ if (res->start % 4 != 0 || resource_size(res) < 4) {
dev_err(&pdev->dev,
- "address must be four bytes wide and aligned\n");
+ "address must be at least four bytes wide and 32-bit aligned\n");
return -EINVAL;
}