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=-8.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 D5FECC433E1 for ; Mon, 15 Jun 2020 19:32:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEE0C20756 for ; Mon, 15 Jun 2020 19:32:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="QBeg3rvb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729836AbgFOTc7 (ORCPT ); Mon, 15 Jun 2020 15:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729839AbgFOTcy (ORCPT ); Mon, 15 Jun 2020 15:32:54 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB845C08C5C6 for ; Mon, 15 Jun 2020 12:32:52 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id x11so1809085plo.7 for ; Mon, 15 Jun 2020 12:32:52 -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=ZjAXfZy5BudfnO86h+8mAf1S7F89/y7Ht34uQW17/+U=; b=QBeg3rvb86U6Tj0IyJR5u6BBRDaGksrhbixbVGEFMNAmYYAm2vi8ezn7Pzjsx+8Y/N 0spIQQjXlTeZa6JYxyI0WQLYZewE/IOrv1eu80kZOYOGkcIsaJYdoUbYKY8F56IoVrW7 todjyiaALbdigpVH6qkq1a3bhohRwm98ntcpI= 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=ZjAXfZy5BudfnO86h+8mAf1S7F89/y7Ht34uQW17/+U=; b=IhdbN6J1RUPuEvYACwN1Flu2QKVCvMatxDDKKjUG5iMyfnZKGl5gEsKq4W0rhseoN6 HxbqlLmsF/9iDlAZ6W5gSfhL93egd2YCm8spyff37Om6PNkZhO+CXcI3ui+HEETrvllk MgKptvfa0V2B++ae6bjyjOGtfjoWtI4VG+pkDqAj/C8x8pNNSvk8NpP0Y2jC23ZwONr4 rrQB/YBUDOqYp2+1dCoXO3Nk15ESVc+YhSd2Dxkhqk1RSssGvnpPx7Wml8/i6DPkgT54 ePcaeqj2g5T26cxUbsvFzdH8D3XI0ie82+AI89j4JN+LJ5emfcWILuVcEsCa7C63itnk WowQ== X-Gm-Message-State: AOAM532L5r5q+Z18ojAFVbac+3TAeUY6X+HknRg17obLIQq2UpPyJj2n HDKo5m2+qjGYBW1dtrE50R5BeQ== X-Google-Smtp-Source: ABdhPJxugszkh+55zcQ6ID8nCD+Y2mp2lHGMEtD9VsXD4kV92TrXKjIOZPR9BYw/ID9xL1GXxiQnCg== X-Received: by 2002:a17:90b:23d2:: with SMTP id md18mr774459pjb.179.1592249571413; Mon, 15 Jun 2020 12:32:51 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n189sm14973604pfn.108.2020.06.15.12.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2020 12:32:50 -0700 (PDT) Date: Mon, 15 Jun 2020 12:32:49 -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 , Saravana Kannan Subject: Re: [PATCH 05/10] ide: Remove uninitialized_var() usage Message-ID: <202006151231.74D2315450@keescook> References: <20200603233203.1695403-1-keescook@chromium.org> <20200603233203.1695403-6-keescook@chromium.org> <202006041318.B0EA9059C7@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On Thu, Jun 04, 2020 at 01:29:44PM -0700, Nick Desaulniers wrote: > On Thu, Jun 4, 2020 at 1:20 PM Kees Cook wrote: > > > > 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! > > Saravana showed me a cool trick for quickly finding commits that > removed a particular identifier that I find faster than `git blame` or > vim-fugitive for the purpose of Fixes tags: > $ git log -S Ah yes, I always have to look up "-S". Good reminder! > I've added it to our wiki: > https://github.com/ClangBuiltLinux/linux/wiki/Command-line-tips-and-tricks#for-finding-which-commit-may-have-removed-a-string-try. > I should update the first tip; what was your suggestion for > constraining the search to the current remote? Ah cool. I've updated it now. It was really to narrow to a "known set of tags", and Linus's tree's tags always start with "v". -- Kees Cook