From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92E1AC433E4 for ; Thu, 4 Jun 2020 19:09:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DA70206A2 for ; Thu, 4 Jun 2020 19:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729737AbgFDTJr (ORCPT ); Thu, 4 Jun 2020 15:09:47 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:34327 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgFDTJp (ORCPT ); Thu, 4 Jun 2020 15:09:45 -0400 Received: by mail-ot1-f66.google.com with SMTP id b18so5664798oti.1; Thu, 04 Jun 2020 12:09:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X+qiK8YjhEONxTpdjX70xl6++OY/MUPwZ+Do1G1LJJ8=; b=GW2eTPu20UwqNX0KYzVZ77nyK4NotTSEGULdpG7s3Iiub4PuOXbACySBtKn3WbvYBh s4b4x4/PUmzOXvAzhlgyyHfBAb0fKY0Pn8Vt/G7D2vPmGXlWvQjPYQg02xRxMblvJKLx uc91xVfPnlqT9KiicR81FI4/0gUdaplWxi3701kx3noorRHkPm+2RP9VCcC5y+Y7f5ZY ikJ9YinXbYMx4cl1TGEqa5GmQBZQlzbHbh6Bfh3zgStaZW+APOiAUiH3iHQ2INqVWP/p 9lucmaqitdqEP3qkf01mvungAwlz41SHVUIsHr8669r0XAAJr1Hof5D/gPpTyuSLOGdA 2BJw== X-Gm-Message-State: AOAM530ihph2ICe7cs5surPRGolnMx5OxNi++eVnn9Lm6h6t6yOl08eq gmTcYMbxDOp7gBeLshNltS1LLbmKEpDozFY7alw= X-Google-Smtp-Source: ABdhPJzhyOhHvYlAI9At8dx2VdKyrIdrlXCUe7od4PVsnRA3/MLtv6c1HELqb/95gRjonFKD9uvMPOkwcy/FsbOWC+M= X-Received: by 2002:a05:6830:141a:: with SMTP id v26mr4936016otp.250.1591297783928; Thu, 04 Jun 2020 12:09:43 -0700 (PDT) MIME-Version: 1.0 References: <20200603233203.1695403-1-keescook@chromium.org> <20200603233203.1695403-10-keescook@chromium.org> <20200604132306.GO6578@ziepe.ca> <202006040757.0DFC3F28E@keescook> In-Reply-To: <202006040757.0DFC3F28E@keescook> From: Geert Uytterhoeven Date: Thu, 4 Jun 2020 21:09:32 +0200 Message-ID: Subject: Re: [PATCH 09/10] treewide: Remove uninitialized_var() usage To: Kees Cook Cc: Jason Gunthorpe , Linux Kernel Mailing List , Linus Torvalds , Miguel Ojeda , Alexander Potapenko , Joe Perches , Andy Whitcroft , "the arch/x86 maintainers" , Lars Ellenberg , linux-block@vger.kernel.org, b43-dev@lists.infradead.org, netdev , linux-wireless , linux-ide@vger.kernel.org, linux-clk , linux-spi , Linux MM , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kees, On Thu, Jun 4, 2020 at 5:01 PM Kees Cook wrote: > On Thu, Jun 04, 2020 at 10:23:06AM -0300, Jason Gunthorpe wrote: > > On Wed, Jun 03, 2020 at 04:32:02PM -0700, Kees Cook wrote: > > > Using uninitialized_var() is dangerous as it papers over real bugs[1] > > > (or can in the future), and suppresses unrelated compiler warnings > > > (e.g. "unused variable"). If the compiler thinks it is uninitialized, > > > either simply initialize the variable or make compiler changes. > > > > > > I preparation for removing[2] the[3] macro[4], remove all remaining > > > needless uses with the following script: > > > > > > git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \ > > > xargs perl -pi -e \ > > > 's/\buninitialized_var\(([^\)]+)\)/\1/g; > > > s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;' > > > > > > drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid > > > pathological white-space. > > > > > > No outstanding warnings were found building allmodconfig with GCC 9.3.0 > > > for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64, > > > alpha, and m68k. > > > > At least in the infiniband part I'm confident that old gcc versions > > will print warnings after this patch. > > > > As the warnings are wrong, do we care? Should old gcc maybe just -Wno- > > the warning? > > I *think* a lot of those are from -Wmaybe-uninitialized, but Linus just > turned that off unconditionally in v5.7: > 78a5255ffb6a ("Stop the ad-hoc games with -Wno-maybe-initialized") > > I'll try to double-check with some older gcc versions. My compiler > collection is mostly single-axis: lots of arches, not lots of versions. ;) Nope, support for the good old gcc 4.1 was removed a while ago. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds