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: 11615421 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 0BEE414E3 for ; Sat, 20 Jun 2020 03:30:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C25F320DD4 for ; Sat, 20 Jun 2020 03:30:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="j8nQ3B7F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C25F320DD4 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 11AA36B009E; Fri, 19 Jun 2020 23:30:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0A4B86B009F; Fri, 19 Jun 2020 23:30:22 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EADE36B00A0; Fri, 19 Jun 2020 23:30:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id CB9B06B009E for ; Fri, 19 Jun 2020 23:30:21 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 89687824556B for ; Sat, 20 Jun 2020 03:30:21 +0000 (UTC) X-FDA: 76948162242.15.humor44_3b0b44426e1e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 5A4891814B0C7 for ; Sat, 20 Jun 2020 03:30:21 +0000 (UTC) X-Spam-Summary: 2,0,0,9927872e6b8557c7,d41d8cd98f00b204,keescook@chromium.org,,RULES_HIT:41:69:355:379:541:800:960:967:968:973:988:989:1260:1311:1314:1345:1437:1515:1535:1541:1711:1730:1747:1777:1792:2393:2525:2559:2567:2570:2682:2685:2693:2703:2859:2898:2933:2937:2939:2942:2945:2947:2951:2954:3022:3352:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6119:6261:8603:8957:9025:10004:11658:13069:13149:13230,0,RBL:209.85.214.193:@chromium.org:.lbl8.mailshell.net-66.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: humor44_3b0b44426e1e X-Filterd-Recvd-Size: 5230 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Sat, 20 Jun 2020 03:30:20 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id y18so4814994plr.4 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=m6Xmgxu2QKZXOefaknGRr6Ckn6JV1jS0svyJQgkakQ/iRwAtHlp96MPUCYA0urSr2Z 8pWY46lHsftajgfVHSyCcE71j9p9rg8eZvqEVYa/8wE/nM+yQEVy/2AjMw00uIRFSkj3 oMogsLfBhLYHZQB1QqblvcWmmfG7LZ7RGhUtnVhAGXVOc1GIxPXD4UsZNiR0GW+MMpTz HZ0TXkkc4gJjRIU6rzCY+3/vGB1RIjoaaEXjA1qCuWiDmA2AzCEDrOJKbR6kquXIfqbF qxcMDJb8qGHBforpl/8aJ5WDN3hTFHiRexnFnzRrZgtcXjRrOXzYfpRpwVs4HxJfX+7E tnTw== X-Gm-Message-State: AOAM531DxyS/SrHA+n9CSxxic6TVAvX0/0J/b0oUxvFP0ct7alukwFYP 9AMwA9jESumGShM8j+6+2rb0Xw== 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 X-Rspamd-Queue-Id: 5A4891814B0C7 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: 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