Messages in this thread | ![/](/images/icornerl.gif) | | From | "Jason A. Donenfeld" <> | Date | Fri, 8 Apr 2022 12:33:47 +0200 | Subject | Re: [PATCH v2] random: allow partial reads if later user copies fail |
| |
Hi David,
On 4/8/22, David Laight <David.Laight@aculab.com> wrote: > From: Jason A. Donenfeld >> Sent: 08 April 2022 00:36 >> >> Rather than failing entirely if a copy_to_user() fails at some point, >> instead we should return a partial read for the amount that succeeded >> prior, unless none succeeded at all, in which case we return -EFAULT as >> before. > > I think you now return -EFAULT for a zero length read.
The diff context doesn't show it, but the first line of the function is `if (!nbytes) return 0;`, before various other bits of work are done.
Jason
| ![\](/images/icornerr.gif) |