Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1506370

Re: [PATCH] flow_dissector: avoid uninitialized variable access

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] flow_dissector: avoid uninitialized variable access
Date 2016-10-22 03:50 +0200
Message-ID <suTBE-5e7-7@gated-at.bofh.it> (permalink)
References <suKoG-7Ei-15@gated-at.bofh.it> <suL1o-8bl-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Oct 21, 2016 at 9:31 AM, Jiri Pirko <jiri@resnulli.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] flow_dissector: avoid uninitialized variable access Arnd Bergmann <arnd@arndb.de> - 2016-10-21 18:00 +0200
  Re: [PATCH] flow_dissector: avoid uninitialized variable access Jiri Pirko <jiri@resnulli.us> - 2016-10-21 18:40 +0200
    Re: [PATCH] flow_dissector: avoid uninitialized variable access Arnd Bergmann <arnd@arndb.de> - 2016-10-21 23:10 +0200
      Re: [PATCH] flow_dissector: avoid uninitialized variable access Arnd Bergmann <arnd@arndb.de> - 2016-10-22 00:20 +0200
        Re: [PATCH] flow_dissector: avoid uninitialized variable access Eric Garver <e@erig.me> - 2016-10-22 18:00 +0200
          Re: [PATCH] flow_dissector: avoid uninitialized variable access Tom Herbert <tom@herbertland.com> - 2016-10-22 20:30 +0200
            [PATCH net-next] flow_dissector: fix vlan tag handling Arnd Bergmann <arnd@arndb.de> - 2016-10-23 22:00 +0200
              Re: [PATCH net-next] flow_dissector: fix vlan tag handling Jiri Pirko <jiri@resnulli.us> - 2016-10-24 10:20 +0200
                Re: [PATCH net-next] flow_dissector: fix vlan tag handling Arnd Bergmann <arnd@arndb.de> - 2016-10-24 18:10 +0200
    Re: [PATCH] flow_dissector: avoid uninitialized variable access Linus Torvalds <torvalds@linux-foundation.org> - 2016-10-22 03:50 +0200
      Re: [PATCH] flow_dissector: avoid uninitialized variable access Jiri Pirko <jiri@resnulli.us> - 2016-10-22 09:00 +0200

csiph-web