Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756008AbcJVBsv (ORCPT ); Fri, 21 Oct 2016 21:48:51 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:35368 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755854AbcJVBsu (ORCPT ); Fri, 21 Oct 2016 21:48:50 -0400 MIME-Version: 1.0 In-Reply-To: <20161021163118.GA2155@nanopsycho.orion> References: <20161021155626.4020344-1-arnd@arndb.de> <20161021163118.GA2155@nanopsycho.orion> From: Linus Torvalds Date: Fri, 21 Oct 2016 18:48:48 -0700 X-Google-Sender-Auth: ymp41PCINNvR0vWTdFFj8kjYuuk Message-ID: Subject: Re: [PATCH] flow_dissector: avoid uninitialized variable access To: Jiri Pirko Cc: Arnd Bergmann , "David S. Miller" , Alexander Duyck , Tom Herbert , Jiri Pirko , Hadar Hen Zion , Gao Feng , Eric Garver , Amir Vadai , Network Development , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 750 Lines: 18 On Fri, Oct 21, 2016 at 9:31 AM, Jiri Pirko 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