From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 155263858D1E; Fri, 30 Sep 2022 18:26:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 155263858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664562363; bh=4EXeEEU1MaC6nIhr57uZe0PvkRqeUcwJfy2ihix9n5E=; h=From:To:Subject:Date:From; b=Xf0UzQCpcRadSQ4KlNnE1Gvb1nu8ljFZtkHIt//zwGoXe6ZD/055tzWJxmJCXSzoU ljUdCwkHjGyRz2+aSG1BFnjRzQtrrhzAGJha3vUk5Fz4ezuV/DWjGZzz8oUuwbm7IW nm5ueKGoMZwQmhDe5N/RvnviSdiI9g07cZ6jtSHM= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: 8b10727a9af3e2aa4b27dff0116bb8d3c9afce3d X-Git-Newrev: 13db9ee2cb3b77e25f852be7d6952882e1be6f00 Message-Id: <20220930182603.155263858D1E@sourceware.org> Date: Fri, 30 Sep 2022 18:26:03 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=13db9ee2cb3b77e25f852be7d6952882e1be6f00 commit 13db9ee2cb3b77e25f852be7d6952882e1be6f00 Author: Adhemerval Zanella 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 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);