From patchwork Sat Jun 20 03:30:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11615449 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 F24DE14E3 for ; Sat, 20 Jun 2020 03:30:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFB202073E for ; Sat, 20 Jun 2020 03:30:50 +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="Rutn4YPk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFB202073E 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 E8AFD6B00A7; Fri, 19 Jun 2020 23:30:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DC2846B00A8; Fri, 19 Jun 2020 23:30:27 -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 C3CE26B00A9; Fri, 19 Jun 2020 23:30:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id A57176B00A7 for ; Fri, 19 Jun 2020 23:30:27 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 74C902DFC for ; Sat, 20 Jun 2020 03:30:27 +0000 (UTC) X-FDA: 76948162494.11.fruit90_3d0d39826e1e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 49B45180F8B81 for ; Sat, 20 Jun 2020 03:30:27 +0000 (UTC) X-Spam-Summary: 2,0,0,98b59d1f21f2d738,d41d8cd98f00b204,keescook@chromium.org,,RULES_HIT:41: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:2565:2570:2682:2685:2703:2859:2902: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:4250:4321:4470:5007:6261:7576:7903:8957:9025:10004:11658:13069:13161:13229,0,RBL:209.85.216.68:@chromium.org:.lbl8.mailshell.net-62.2.0.100 66.100.201.201,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:23,LUA_SUMMARY:none X-HE-Tag: fruit90_3d0d39826e1e X-Filterd-Recvd-Size: 5094 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Sat, 20 Jun 2020 03:30:26 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id ga6so4998901pjb.1 for ; Fri, 19 Jun 2020 20:30:26 -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=I53/n5ydJ9yzbnxtmoDriMZB814XLzfic4sznaesD40=; b=Rutn4YPkcmqXLdEaPjRwH0N9ohbI/CzpH9cf5y9vG4nYpAw1nQr5aBkVvJ5iC9ui6q cLu5pHW/44+v6JlX39sxqMfNukxEy6S08EOmpnYgt90MBK4lvmz1Qm66oVfcHJZShxiQ h7SFiaUV2yA5KII9Om+c9u+JdAg6xNa2K9JLA= 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=I53/n5ydJ9yzbnxtmoDriMZB814XLzfic4sznaesD40=; b=H5f71aNKbggPRT1ZZchKdZkm7Smoa7WKnvehyZ3dtkVJSpc46UzM552appKFCKUrLC y3/owbeOQScg/KxtSCdmbL9g88vpZowlRl+oVm6j58oJdPRkt7HVKP8onhkj+tsganxh AzTEAX4JKxx8lSmTACueTNocTWvs8ABgyrkCs1MYVuLMKmzeUrr4Q7wsMPbqghQTU7fU MQCwnUb1qk2trlrUYUSoLUUSpFlKzr0N4ukFmaDPSTJ+iixDlib03bKQ4pjZcytxQ2xY Q3NBHR3mUy1C0WV3EVdOypPeHApGCACk1ypqFcQbEC8tKjHvOKYnWU6J93zQR4Z+Dpj1 fAOQ== X-Gm-Message-State: AOAM533YKINS3zhHvNF5+t9gDa/YR5agFjuKrNXMfFIWKMvZypU6WsKL LeMrImaJARjpDRQ7UF4OOvnmrA== X-Google-Smtp-Source: ABdhPJzDpg8kRLeVgrehMBlr+1UwoiUH6XXfWvLx404+vNnybEp9T2mmhskRjq6n4U4EQRsEK9B3AQ== X-Received: by 2002:a17:902:ff06:: with SMTP id f6mr10351618plj.22.1592623826055; Fri, 19 Jun 2020 20:30:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 17sm7373750pfn.19.2020.06.19.20.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 20:30:20 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Jason Yan , Chao Yu , 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 12/16] f2fs: Eliminate usage of uninitialized_var() macro Date: Fri, 19 Jun 2020 20:30:03 -0700 Message-Id: <20200620033007.1444705-13-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: 49B45180F8B81 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: From: Jason Yan This is an effort to eliminate the uninitialized_var() macro[1]. The use of this macro is the wrong solution because it forces off ANY analysis by the compiler for a given variable. It even masks "unused variable" warnings. Quoted from Linus[2]: "It's a horrible thing to use, in that it adds extra cruft to the source code, and then shuts up a compiler warning (even the _reliable_ warnings from gcc)." Fix it by remove this variable since it is not needed at all. [1] https://github.com/KSPP/linux/issues/81 [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ Suggested-by: Chao Yu Signed-off-by: Jason Yan Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20200615085132.166470-1-yanaijie@huawei.com Signed-off-by: Kees Cook --- fs/f2fs/data.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 326c63879ddc..3753ba06531b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2856,7 +2856,6 @@ static int f2fs_write_cache_pages(struct address_space *mapping, }; #endif int nr_pages; - pgoff_t uninitialized_var(writeback_index); pgoff_t index; pgoff_t end; /* Inclusive */ pgoff_t done_index; @@ -2875,8 +2874,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, clear_inode_flag(mapping->host, FI_HOT_DATA); if (wbc->range_cyclic) { - writeback_index = mapping->writeback_index; /* prev offset */ - index = writeback_index; + index = mapping->writeback_index; /* prev offset */ end = -1; } else { index = wbc->range_start >> PAGE_SHIFT;