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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 474E1C43461 for ; Mon, 26 Apr 2021 20:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1219C61090 for ; Mon, 26 Apr 2021 20:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241757AbhDZUWh (ORCPT ); Mon, 26 Apr 2021 16:22:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:49682 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238112AbhDZUWf (ORCPT ); Mon, 26 Apr 2021 16:22:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C6A5AAEB6; Mon, 26 Apr 2021 20:21:51 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id B7D30DA7F9; Mon, 26 Apr 2021 22:19:29 +0200 (CEST) Date: Mon, 26 Apr 2021 22:19:29 +0200 From: David Sterba To: Khaled ROMDHANI Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH-next] fs/btrfs: Fix uninitialized variable Message-ID: <20210426201929.GI7604@suse.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Khaled ROMDHANI , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20210423124201.11262-1-khaledromdhani216@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210423124201.11262-1-khaledromdhani216@gmail.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 23, 2021 at 01:42:01PM +0100, Khaled ROMDHANI wrote: > The variable 'zone' is uninitialized which > introduce some build warning. > > It is not always set or overwritten within > the function. So explicitly initialize it. > > Reported-by: kernel test robot > Signed-off-by: Khaled ROMDHANI > --- > fs/btrfs/zoned.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > index 432509f4b3ac..42f99b25127f 100644 > --- a/fs/btrfs/zoned.c > +++ b/fs/btrfs/zoned.c > @@ -136,7 +136,7 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones, > */ > static inline u32 sb_zone_number(int shift, int mirror) > { > - u64 zone; > + u64 zone = 0; This is exactly same as v1 https://lore.kernel.org/linux-btrfs/20210413130604.11487-1-khaledromdhani216@gmail.com/ It does fix the build warning but does not make sense in the code because it would would silently let mirror == 4 pass. I think there was enough feedback under the previous posts how to fix that properly.