[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whjz3wO8zD+itoerphWem+JZz4uS3myf6u1Wd6epGRgmQ@mail.gmail.com>
Date: Tue, 14 Jun 2022 11:30:47 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Alexander Potapenko <glider@...gle.com>
Cc: Evgenii Stepanov <eugenis@...gle.com>,
Kees Cook <keescook@...omium.org>,
Marco Elver <elver@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Vitaly Buka <vitalybuka@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-toolchains <linux-toolchains@...r.kernel.org>
Subject: Re: [PATCH] [RFC] Initialization of unused function parameters
On Tue, Jun 14, 2022 at 11:08 AM Alexander Potapenko <glider@...gle.com> wrote:
>
> On Tue, Jun 14, 2022 at 6:48 PM Linus Torvalds
> >
> > I'm assuming you mean pass by reference.
>
> No, sorry for being unclear. I mean passing by value.
Pass-by-value most definitely should warn about uninitialized variables.
> In the given example the prototype of step_into looks as follows (see
> https://elixir.bootlin.com/linux/latest/source/fs/namei.c#L1846):
>
> static const char *step_into(struct nameidata *nd, int flags, struct
> dentry *dentry, struct inode *inode, unsigned seq);
>
> , and the local variables `struct inode *inode` and `unsigned seq` are
> being passed to it by value, i.e. in certain cases the struct inode
> pointer and the unsigned seq are uninitialized.
Then those cases should warn. No question about it.
I assume the only reason they don't warn right now is that the
compiler doesn't see that they are uninitialized, possibly due to some
earlier pass-by-reference use.
Linus
Powered by blists - more mailing lists