]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hwrng: core - use sysfs_emit_at in rng_available_show
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 5 May 2026 09:45:58 +0000 (11:45 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 15 May 2026 10:08:37 +0000 (18:08 +0800)
commitcdf940215537d6028177eea88e89bd8788719a99
tree70e0fc964510aa8f291075b7ab9d22542efe3261
parentdc3ec9af62a92a46378960e599521c2ac5f81343
hwrng: core - use sysfs_emit_at in rng_available_show

Replace strlcat() with sysfs_emit_at() in rng_available_show() and add
'int len' to keep track of the number of bytes written. sysfs_emit_at()
is preferred for formatting sysfs output because it provides safer
bounds checking.

Inline mutex_lock_interruptible() and drop the now-unused local error
variable. Remove the unnecessary 'buf' NUL initialization. Return 'len'
directly instead of strlen(buf).

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c