On Fri, Jun 18, 2021 at 2:32 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> 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