diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-09-29 16:15:20 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-09-30 15:24:49 -0300 |
commit | 13db9ee2cb3b77e25f852be7d6952882e1be6f00 (patch) | |
tree | 7248da21444c714b89322a372cd0c7ec0247c0fb | |
parent | 8b10727a9af3e2aa4b27dff0116bb8d3c9afce3d (diff) | |
download | glibc-13db9ee2cb3b77e25f852be7d6952882e1be6f00.zip glibc-13db9ee2cb3b77e25f852be7d6952882e1be6f00.tar.gz glibc-13db9ee2cb3b77e25f852be7d6952882e1be6f00.tar.bz2 |
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>
-rw-r--r-- | stdlib/arc4random.c | 2 | ||||
-rw-r--r-- | 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 e417ef6..960a38f 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 a263d29..cf35c8b 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); |