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.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 15433C433DF for ; Thu, 4 Jun 2020 14:59:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C415820823 for ; Thu, 4 Jun 2020 14:59:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TupHTdyg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C415820823 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6FC00280001; Thu, 4 Jun 2020 10:59:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AC658E0006; Thu, 4 Jun 2020 10:59:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 574ED280001; Thu, 4 Jun 2020 10:59:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 40ADC8E0006 for ; Thu, 4 Jun 2020 10:59:44 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D779A1AA7E for ; Thu, 4 Jun 2020 14:59:43 +0000 (UTC) X-FDA: 76891838646.09.rings29_7200fc61d890c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id B5AFC1803376B for ; Thu, 4 Jun 2020 14:59:43 +0000 (UTC) X-HE-Tag: rings29_7200fc61d890c X-Filterd-Recvd-Size: 4939 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Jun 2020 14:59:43 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id x22so3374651pfn.3 for ; Thu, 04 Jun 2020 07:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xZR3lWkoYpLFg4eE+Etif6ukCUL5ApBdi/GoHnvWaEk=; b=TupHTdygAigywhS3pB8tAlBUKta4lXvoAYH4dzNzhrASd2l3DGn01fOXPA/fx+ddwx e63Z0EnMX9EmBApvSxhudimZg0Kyu1Ran7gh+CyYHPG3fZ0CjgSq6NhbXpLphCrF+Ouq t2GxHonz+RRUwsB+KYTkj8rNjo2/BKZIMEe8c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xZR3lWkoYpLFg4eE+Etif6ukCUL5ApBdi/GoHnvWaEk=; b=KObilwR/L49tQo80IJEPfDDwNdmDKcxgjzogfznwz4yUwBiN4t+DRCKpAQCeg9JQD+ 17yMmF5Im/fdMrR0rk5U63AZCxpmCNpliCx0upLr04BYQl+p735BkZh6IWqMWuaVAy5H ScOu0uaM/zF82B+NhSRGCUSbBUHFXziWTORyK78Z1rSlu2QGd9DYDop1FwirBnxDLgly CCoVfxHptZgNUHndnd1soVT6JeTnr6Fzv4bSpfB+IJ6L0HIq6eZBFCA1MgJx1zdZ0lIl g7S//OKAXWtGT2Mcm0yXfnYZQWt88eh0/tNcnQB3azfsrDFt9Gp4RRmt3y75Etvc8/fs y2KQ== X-Gm-Message-State: AOAM533eSKH3h8RsdEKi/Ay68AbK/PQmSbKKsuHDqSgWswZJibpxjImy +hHBo6DWuSDRz1VhqSrx7/zkhw== X-Google-Smtp-Source: ABdhPJwvM5Okdp4t/lqPdqt9FJOxz3H8PoeKTiCxL62lJBkvY0bVXGWNEvmo0e7yAT0Y8leJzLPW1g== X-Received: by 2002:a63:d544:: with SMTP id v4mr4979382pgi.60.1591282782325; Thu, 04 Jun 2020 07:59:42 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w65sm4752697pfb.160.2020.06.04.07.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 07:59:41 -0700 (PDT) Date: Thu, 4 Jun 2020 07:59:40 -0700 From: Kees Cook To: Jason Gunthorpe Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Miguel Ojeda , Alexander Potapenko , Joe Perches , Andy Whitcroft , x86@kernel.org, drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, b43-dev@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-ide@vger.kernel.org, linux-clk@vger.kernel.org, linux-spi@vger.kernel.org, linux-mm@kvack.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH 09/10] treewide: Remove uninitialized_var() usage Message-ID: <202006040757.0DFC3F28E@keescook> References: <20200603233203.1695403-1-keescook@chromium.org> <20200603233203.1695403-10-keescook@chromium.org> <20200604132306.GO6578@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200604132306.GO6578@ziepe.ca> X-Rspamd-Queue-Id: B5AFC1803376B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. ;) > Otherwise the IB bits look ok to me > > Acked-by: Jason Gunthorpe Thanks! -- Kees Cook