Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1498708ybt; Mon, 15 Jun 2020 01:41:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyootMUKmneeMRkrNW3ecxSqazdzGIIG0iv/DLphr4SJAnIETsP7TTixYj4+C6pres7RAdL X-Received: by 2002:a17:906:a402:: with SMTP id l2mr12719750ejz.14.1592210483153; Mon, 15 Jun 2020 01:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592210483; cv=none; d=google.com; s=arc-20160816; b=l81jsxjnLCu2z/VvBywgAuIwMxvI8QxNz8Icusxn/nK3cNx1h1cRyebU3nGECJDbmO x0cXZeu3JZPpJhG7MSTXcR5IEngEMq/hcp5RPHhg/5kIqPUumnZ8mhG3pMWBvnoUn+0n CiNdi7UWiqg6C+FqZYEc6FzF4hQI+B5PFFJtqfoYsTM747nAVrcStZ0MiPT0oJcUPW+C t9+/ey8CgVpoS3bocWu2Z9pLKtjb4e9Rk5kgO1tXnld6a7Xn479VgMSeOjFiizlN74/p 3ZsaIwwjb1ZkaR9CQ/X05aFqTBY8DJ5y+mtLLf4AzKE6ot/YhDcC7ajsZopF3IuR6/7B 390w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=RpMMNXdHyje8/Fl56wbS1tIR2g9Bwoow830hGY4QNPo=; b=XSGP0cOoXxOFIxJuGs/lN+QpxqvhNXT1ettIwc+Wg3lsjgiWlWHuYPuTeKCIEVh/IF Ub5rHn6Ou4SPAaVq9BNNsc4SkwlnSSsL16cmIlzCxIbLCZEBieAGVscgMI8HMM+nZEwn n1YdLZ/fGHkXjg0PiGDBV1I/PbUIacuSoYfJeDtR5SHFwYmlvYgphMWepucnB4oP2l2L /vL6II6+OMAqG5WU/Z3SPT8LWWPs+IqeX/gZqVW1KZ4YkAeYyv/PTVk8RbyFshHAgepG szQqYkc//0wPT2e51KouHgnJZ0RmckIyi83Fe4sHnW1F/T3/YmWNCzQeNyKlWJzoIzDL F2gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx20si8959860ejb.643.2020.06.15.01.41.00; Mon, 15 Jun 2020 01:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728852AbgFOIiz (ORCPT + 99 others); Mon, 15 Jun 2020 04:38:55 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:39154 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728603AbgFOIiz (ORCPT ); Mon, 15 Jun 2020 04:38:55 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BC13CC896FF6F3D15053; Mon, 15 Jun 2020 16:38:47 +0800 (CST) Received: from [127.0.0.1] (10.166.213.7) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Mon, 15 Jun 2020 16:38:38 +0800 Subject: Re: [f2fs-dev] [PATCH] f2fs: Eliminate usage of uninitialized_var() macro To: Chao Yu , , , , CC: Kees Cook , References: <20200615040212.3681503-1-yanaijie@huawei.com> From: Jason Yan Message-ID: Date: Mon, 15 Jun 2020 16:38:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.166.213.7] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/6/15 16:26, Chao Yu 写道: > On 2020/6/15 12:02, Jason Yan wrote: >> 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)." >> >> The gcc option "-Wmaybe-uninitialized" has been disabled and this change >> will not produce any warnnings even with "make W=1". >> >> [1] https://github.com/KSPP/linux/issues/81 >> [2] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ >> >> Cc: Kees Cook >> Signed-off-by: Jason Yan >> --- >> fs/f2fs/data.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c >> index 326c63879ddc..e6ec61274d76 100644 >> --- a/fs/f2fs/data.c >> +++ b/fs/f2fs/data.c >> @@ -2856,7 +2856,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, >> }; >> #endif >> int nr_pages; >> - pgoff_t uninitialized_var(writeback_index); >> + pgoff_t writeback_index; > > I suggest to delete this variable directly, as we did for mm in > commit 28659cc8cc87 (mm/page-writeback.c: remove unused variable). > Good suggestion, I will send v2. Thanks, Jason > Thanks, > >> pgoff_t index; >> pgoff_t end; /* Inclusive */ >> pgoff_t done_index; >> > > . >