From owner-svn-src-stable@freebsd.org Sun Jun 11 09:33:10 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3C8C77F76; Sun, 11 Jun 2017 09:33:10 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49D3D85169; Sun, 11 Jun 2017 09:33:10 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5B9X9iP006150; Sun, 11 Jun 2017 09:33:09 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5B9X9QJ006148; Sun, 11 Jun 2017 09:33:09 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201706110933.v5B9X9QJ006148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 11 Jun 2017 09:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r319823 - stable/11/sys/compat/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jun 2017 09:33:10 -0000 Author: dchagin Date: Sun Jun 11 09:33:09 2017 New Revision: 319823 URL: https://svnweb.freebsd.org/changeset/base/319823 Log: MFC r319571: On success, getrandom() Linux system call returns the number of bytes that were copied to the buffer supplied by the user. PR: 219464 Submitted by: Maciej Pasternacki Reported by: Maciej Pasternacki Approved by: re (kib) Modified: stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Sun Jun 11 04:03:09 2017 (r319822) +++ stable/11/sys/compat/linux/linux_misc.c Sun Jun 11 09:33:09 2017 (r319823) @@ -2516,6 +2516,7 @@ linux_getrandom(struct thread *td, struct linux_getran { struct uio uio; struct iovec iov; + int error; if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM)) return (EINVAL); @@ -2532,7 +2533,10 @@ linux_getrandom(struct thread *td, struct linux_getran uio.uio_rw = UIO_READ; uio.uio_td = td; - return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK)); + error = read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK); + if (error == 0) + td->td_retval[0] = args->count - uio.uio_resid; + return (error); } int