[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgkEDmf7V+F5jP6On3=pEewRYGbZyvs1E3K-3n3HYr4=Q@mail.gmail.com>
Date: Sun, 9 Feb 2025 10:40:34 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: David Laight <david.laight.linux@...il.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Arnd Bergmann <arnd@...db.de>, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH 1/2] uaccess: Simplify code pattern for masked user copies
On Sun, 9 Feb 2025 at 10:34, David Laight <david.laight.linux@...il.com> wrote:
>
> For real functions they do generate horrid code.
It';s not about the code generation,.
Well, yes, it is that too in other circumstances, but that's not the
deeper issue.
The deeper issue is this:
> > Yes, you can make spaghetti code with goto and labels. But 'return
> > value in arguments' is worse, because it makes the *data flow* harder
> > to see.
This is the issue that is entirely independent of what the code
generation is. This is the issue that affects humans reading the
source.
It's *really* easy to miss the "oh, that changes X" when the only
little tiny sign of it is that "&" character inside the argument list,
and then the *normal* mental model is that arguments are arguments
*to* the function, not returns *from* the function.
(And yes, I admit that is inconsistent: we have lots of cases where we
have structures etc that get filled in or modified by functions, and
are passed by reference all the time. But I think there's a big
difference between a regular "value" like a user pointer, and a
complex data structure).
Linus
Powered by blists - more mailing lists