Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper

From: Linus Torvalds
Date: Wed Sep 25 2019 - 14:13:41 EST


On Wed, Sep 25, 2019 at 11:04 AM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> IMO it's better to lift reading the first word out of the loop, like this:
> ...
> Do you see any problems with that variant?

That looks fine to me too.

It's a bit harder for humans to read because of how it reads the word
from user space one iteration early, but from a code generation
standpoint it probably is better.

So slightly subtler source code, and imho harder to read, but it looks
correct to me.

Linus