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=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 CFCE1C433E2 for ; Thu, 4 Jun 2020 20:20:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8FD0820825 for ; Thu, 4 Jun 2020 20:20:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jAmWlkIQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FD0820825 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 39E1C80008; Thu, 4 Jun 2020 16:20:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 34D718E0006; Thu, 4 Jun 2020 16:20:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EEA680008; Thu, 4 Jun 2020 16:20:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F22C98E0006 for ; Thu, 4 Jun 2020 16:20:03 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A8C80181AC9B6 for ; Thu, 4 Jun 2020 20:20:03 +0000 (UTC) X-FDA: 76892645886.12.worm61_0f0be3926d9a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 81E661821D1B9 for ; Thu, 4 Jun 2020 20:20:03 +0000 (UTC) X-HE-Tag: worm61_0f0be3926d9a X-Filterd-Recvd-Size: 5151 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Jun 2020 20:20:02 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id b7so2497382pju.0 for ; Thu, 04 Jun 2020 13:20:02 -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=gz66RqxXF5KGuRHQ0GYBuygtpEJiPzNI0sTLh4Vu69Y=; b=jAmWlkIQJZzKdLIy24SnHWINuzTVOS3/wjvm2cU2AFi5wGPpwqQkjWfOwBraDHgs8k bMHElbdbRxBbtC27xZm6mEe99uDc96pKouYmbV/dc0+e2MIiE2jcwrdVq98w16mgeguV 2DhLtfyu1wmL1bs6o/3S7BQ/OXA9/tFItMGTU= 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=gz66RqxXF5KGuRHQ0GYBuygtpEJiPzNI0sTLh4Vu69Y=; b=FlRPPM7wY1XtTjn0uI7OlFLo9+ADLOXA3og7zxUbebrRfG7pjCqDuTmj/QHzf+a0x0 Os7Qq0qckaQfFiaJMTYzsy239wAatiJ9WvM7tbyb34EAIbbptMNhzM+HFLkYU1BWriHI WSzzToWXosSuf5jO9Cml9UAFFCnRMT0D/cjeAgKscMxX7zJK8H+oFvsov1RtJeXI1Oc4 LQuvrEt27/7b4D7Lw1RWDmmQKb1VssJEjxq4aMRFLH9R+PzEvINyM4PE0VcGUxB177tQ VNyjJYDoBYXkBBW+aySIpMbUt4G7RfDKIsMTSywz9RtAbgsCcL7C1v/jaSk4B6FGGMOD gp3Q== X-Gm-Message-State: AOAM530f+GsZl7LnoQGOnotXR2P8eqSO2J6mOrmViFQQS05vLsLhUgb2 HkhcVRtTx8sYgMpD/nzvYRS49g== X-Google-Smtp-Source: ABdhPJxkV30NNQPml+L5dx48JHt30SosyvH9CeJOsvPeKMxl1Di1uyDaJOg4t+7npffgj0Ki2XTH3Q== X-Received: by 2002:a17:90a:7043:: with SMTP id f61mr7838452pjk.140.1591302001916; Thu, 04 Jun 2020 13:20:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g17sm1432553pju.11.2020.06.04.13.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 13:20:01 -0700 (PDT) Date: Thu, 4 Jun 2020 13:20:00 -0700 From: Kees Cook To: Nick Desaulniers Cc: LKML , Linus Torvalds , Miguel Ojeda , Alexander Potapenko , Joe Perches , Andy Whitcroft , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, b43-dev@lists.infradead.org, Network Development , linux-wireless , linux-ide@vger.kernel.org, linux-clk@vger.kernel.org, linux-spi@vger.kernel.org, Linux Memory Management List , clang-built-linux , Sebastian Andrzej Siewior Subject: Re: [PATCH 05/10] ide: Remove uninitialized_var() usage Message-ID: <202006041318.B0EA9059C7@keescook> References: <20200603233203.1695403-1-keescook@chromium.org> <20200603233203.1695403-6-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 81E661821D1B9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 12:29:17PM -0700, Nick Desaulniers wrote: > On Wed, Jun 3, 2020 at 4:32 PM 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. As a precursor > > to removing[2] this[3] macro[4], just remove this variable since it was > > actually unused: > > > > drivers/ide/ide-taskfile.c:232:34: warning: unused variable 'flags' [-Wunused-variable] > > unsigned long uninitialized_var(flags); > > ^ > > > > [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/ > > [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/ > > [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/ > > [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ > > > > Signed-off-by: Kees Cook > > Reviewed-by: Nick Desaulniers Thanks for the reviews! > Fixes ce1e518190ea ("ide: don't disable interrupts during kmap_atomic()") I originally avoided adding Fixes tags because I didn't want these changes backported into a -stable without -Wmaybe-uninitialized disabled, but in these cases (variable removal), that actually does make sense. Thanks! -Kees -- Kees Cook