hwrng: ba431 - fix reported byte count
Subsystems (2)
PATCH 1/1 hwrng: ba431 - fix reported byte count
Use the size of the buffer element instead of the pointer size to report the number of bytes read. Since data is a u32 pointer and sizeof(data) is 8 bytes on 64-bit systems, using the pointer size reports twice the number of bytes actually read.
Fixes 0289e9be5dc2 ("hwrng: ba431 - add support for BA431 hwrng")
Signed-off-by Thorsten Blum <[email protected]>
--- drivers/char/hw_random/ba431-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/ba431-rng.c +1 -1
@@ -147,7 +147,7 @@ static int ba431_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait) } } - n *=sizeof (data); + n *=sizeof (*data);return (n || !wait) ? n : -EIO ; }
Herbert Xu
maintainerQuoted 11 lines · Thorsten Blum
Use the size of the buffer element instead of the pointer size to report the number of bytes read. Since data is a u32 pointer and sizeof(data) is 8 bytes on 64-bit systems, using the pointer size reports twice the number of bytes actually read.
Fixes 0289e9be5dc2 ("hwrng: ba431 - add support for BA431 hwrng")Signed-off-by Thorsten Blum <[email protected]>--- drivers/char/hw_random/ba431-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt