From patchwork Sat Jun 20 03:29:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11615543 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE2E814E3 for ; Sat, 20 Jun 2020 03:33:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95F0C2339E for ; Sat, 20 Jun 2020 03:33:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="j8nQ3B7F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732877AbgFTDal (ORCPT ); Fri, 19 Jun 2020 23:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732870AbgFTDa0 (ORCPT ); Fri, 19 Jun 2020 23:30:26 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81FC7C061260 for ; Fri, 19 Jun 2020 20:30:20 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id d8so4803868plo.12 for ; Fri, 19 Jun 2020 20:30:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Fi8ab2CkfvIdd/5P+r0S5dxyJT2k4tSVWykkUvi99fU=; b=j8nQ3B7FpehCsunpSEVQSYjhSIMs22zucCRygwZBlcD7nkUj3GKDredCjm7jP++dYB i7TY+cL1cZ8JWvzIZIwoGoSA4hKFNbTalPofMuwWJS+BqEcADvjf61J9SbvMWxiL2Qla oIQyEGAM0IVcrPLyW1oKnN6H6KktioV1Ny5ps= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Fi8ab2CkfvIdd/5P+r0S5dxyJT2k4tSVWykkUvi99fU=; b=dmn9ROdHhC/uKABnCZkdJIA8cml/T7/YdrsVDDV+sFtsKY87hEPnC34jSXN5UDR1Ld rLUz6dhkMd/gD+vwS9sDOP3kGlTHU5vLOXNmEIpaCcWCadsrd7UczZb/6pxCbgXJQnZj X020vEGcTW0WkdYlqw5zBSDCPtoPL7f3xQeDOJoSBsyFW+1Fppbx+kqemhbTT8AImAP/ Zj4qbhHDBzmkDV2ib4QdHVkk7ERQvmPkC4kxxPEJzJwdbCO4aBxryALEsa1LdTYw5bP6 gXe0NRh0C0H1r0ZwS/hsEG7GPPDBOE3zAUnSxrMPlW2hJHNibk5/98+YfIDonmnKWB44 u4DA== X-Gm-Message-State: AOAM532qTWDbpHHH+0AbYvpGIaYoBfAofie7O3D6wgdZU4G/phSah+qF /3Gr7J1llsGRvEfiQ+9MqACUoA== X-Google-Smtp-Source: ABdhPJzKykKp69oTsLEAQ228A8aBga9uw6xzilqOJlYhvnET2ogoJrzcYkicI+7HggPAmmAR7pqRqg== X-Received: by 2002:a17:90b:3614:: with SMTP id ml20mr6333214pjb.41.1592623820052; Fri, 19 Jun 2020 20:30:20 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id p19sm7198155pff.116.2020.06.19.20.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 20:30:17 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , 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-doc@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: [PATCH v2 01/16] docs: deprecated.rst: Add uninitialized_var() Date: Fri, 19 Jun 2020 20:29:52 -0700 Message-Id: <20200620033007.1444705-2-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200620033007.1444705-1-keescook@chromium.org> References: <20200620033007.1444705-1-keescook@chromium.org> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Nothing should be using this macro, and the entire idea of tricking the compiler into silencing such warnings is a mistake. Signed-off-by: Kees Cook Reviewed-by: Nick Desaulniers --- Documentation/process/deprecated.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst index 652e2aa02a66..943a926ecbbb 100644 --- a/Documentation/process/deprecated.rst +++ b/Documentation/process/deprecated.rst @@ -51,6 +51,24 @@ to make sure their systems do not continue running in the face of "unreachable" conditions. (For example, see commits like `this one `_.) +uninitialized_var() +------------------- +For any compiler warnings about uninitialized variables, just add +an initializer. Using the uninitialized_var() macro (or similar +warning-silencing tricks) is dangerous as it papers over `real bugs +`_ +(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. Keep in +mind that in most cases, if an initialization is obviously redundant, +the compiler's dead-store elimination pass will make sure there are no +needless variable writes. + +As Linus has said, this macro +`must `_ +`be `_ +`removed `_. + open-coded arithmetic in allocator arguments -------------------------------------------- Dynamic size calculations (especially multiplication) should not be