* [PATCH] hwrng: ba431 - fix reported byte count
@ 2026-09-24 9:33 Thorsten Blum
2026-10-02 10:12 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-09-24 9:33 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Bjorn Helgaas, Takashi Sakamoto,
Uwe Kleine-König (The Capable Hub),
Danilo Krummrich, Olivier Sobrie, Waleed Ziad, Arnd Bergmann
Cc: Thorsten Blum, linux-crypto, linux-kernel
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")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/char/hw_random/ba431-rng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/ba431-rng.c b/drivers/char/hw_random/ba431-rng.c
index b0a39032c610..810c8cd5629a 100644
--- a/drivers/char/hw_random/ba431-rng.c
+++ b/drivers/char/hw_random/ba431-rng.c
@@ -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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] hwrng: ba431 - fix reported byte count
2026-09-24 9:33 [PATCH] hwrng: ba431 - fix reported byte count Thorsten Blum
@ 2026-10-02 10:12 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-10-02 10:12 UTC (permalink / raw)
To: Thorsten Blum
Cc: Olivia Mackall, Bjorn Helgaas, Takashi Sakamoto,
Uwe Kleine-König (The Capable Hub),
Danilo Krummrich, Olivier Sobrie, Waleed Ziad, Arnd Bergmann,
linux-crypto, linux-kernel
On Thu, Sep 24, 2026 at 11:33:59AM +0200, Thorsten Blum wrote:
> 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")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
> drivers/char/hw_random/ba431-rng.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-02 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 9:33 [PATCH] hwrng: ba431 - fix reported byte count Thorsten Blum
2026-10-02 10:12 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®