public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
@ 2022-09-30 18:26 Adhemerval Zanella
0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-09-30 18:26 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=13db9ee2cb3b77e25f852be7d6952882e1be6f00
commit 13db9ee2cb3b77e25f852be7d6952882e1be6f00
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Sep 29 16:15:20 2022 -0300
stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
Using an unsigned type prevents the fallback to be used if kernel
does not support getrandom syscall.
Checked on x86_64-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Diff:
---
stdlib/arc4random.c | 2 +-
sysdeps/unix/sysv/linux/not-cancel.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
index e417ef624d..960a38f295 100644
--- a/stdlib/arc4random.c
+++ b/stdlib/arc4random.c
@@ -34,7 +34,7 @@ void
__arc4random_buf (void *p, size_t n)
{
static int seen_initialized;
- size_t l;
+ ssize_t l;
int fd;
if (n == 0)
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index a263d294b1..cf35c8bfc9 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
}
-static inline int
+static inline ssize_t
__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
{
return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-30 18:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 18:26 [glibc] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).