[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com>
Date: Fri, 21 Oct 2016 18:48:48 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jiri Pirko <jiri@...nulli.us>
Cc: Arnd Bergmann <arnd@...db.de>,
"David S. Miller" <davem@...emloft.net>,
Alexander Duyck <aduyck@...antis.com>,
Tom Herbert <tom@...bertland.com>,
Jiri Pirko <jiri@...lanox.com>,
Hadar Hen Zion <hadarh@...lanox.com>,
Gao Feng <fgao@...ai8.com>, Eric Garver <e@...g.me>,
Amir Vadai <amir@...ai.me>,
Network Development <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] flow_dissector: avoid uninitialized variable access
On Fri, Oct 21, 2016 at 9:31 AM, Jiri Pirko <jiri@...nulli.us> wrote:
>
> I don't see how vlan could be used uninitialized. But I understand that
> this is impossible for gcc to track it. Please just use uninitialized_var()
Actually, I think we should never use "uninitialized_var()" except
possibly for arrays or structures that gcc can complain about.
It's a horrible thing to use, in that it adds extra cruft to the
source code, and then shuts up a compiler warning (even the _reliable_
warnings from gcc).
It's much better to just initialize the variable, and if gcc some day
gets smarter and sees that it is unnecessary and always overwritten,
so much the better. The cost of initializing a single word is
basically zero.
Linus
Powered by blists - more mailing lists