Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter()
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-06-18 21:41:11
Also in:
linux-btrfs, linux-fsdevel
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-06-18 21:41:11
Also in:
linux-btrfs, linux-fsdevel
On Fri, Jun 18, 2021 at 2:32 PM Al Viro [off-list ref] wrote:
Huh? All corner cases are already taken care of by copy_from_iter{,_full}().
What I'm proposing is to have the size as a field in 'encoded' and
do this
Hmm. Making it part of the structure does make it easier (also for the
sending userspace side, that doesn't now have to create yet another
iov or copy the structure or whatever).
Except your code doesn't actually handle the "smaller than expected"
case correctly, since by the time it even checks for that, it will
possibly already have failed. So you actually had a bug there - you
can't use the "xyz_full()" version and get it right.
That's fixable.
So I guess I'd be ok with that version.
Linus