Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2970081pxb; Tue, 13 Apr 2021 15:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGWkJaHzI/BYqe0CeUnezEPFWqDre3NJbdOcAmVPyfpSyZmPLeNk3FwFbwZNUWqA5Bxj9n X-Received: by 2002:a63:6ec3:: with SMTP id j186mr33919773pgc.249.1618351700137; Tue, 13 Apr 2021 15:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618351700; cv=none; d=google.com; s=arc-20160816; b=0JOYcmD4pLrBkbkbleYqJdMWU0UKlLjdrx7X8NJ8/M9fr2n1zfKIZcSBtFBgg2kha1 sF0u6thwh/nBPlZT3KD/2zr0raWBN/ivX4L/kiPtzWivBcs/16FWuoA99Sa2crSuunzI sotMNRR0YC6J8RnA8bkwE38cQaRV+hCKveD0PjNoY9me0SRDLy3umGfb1FDMUqCIrdHh cyVIQjfMiUCTVFvj3YDDfX8GDRClcqbGGf318ZfxVxOoD/GsXuBoNPuGftn76Mb5G+Td JGaAS1NGBHSbl8LpHArxLiBSD6hNZY/7Cd7HSymAnI5vpiHD65N7g2xEqeMiCpsJPmWY y29g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=FAxzhQis+VzV9EuRK6sBuAnym9gl5bJPLVFhKy7PrYc=; b=mA6emKx2cAFehwP7mGd7Maqj5jrtDcqjuvxImZiSXXtGIRB7GZZO0ZyZyAyeUyB4/k HvgcNXvQVgROl5CUanFy6V2428Uq013JMzGh9Veh1f8RfhFmRyTpi+KRx9BzR0stZLnt isA3t2E4tUhsL1TAhtTY2I34e/7cXLIr5FXOpianjgBok6gk6rsdq0vyVZouH/ZzRmj0 KYNgrOl0wYi3qqV3KWTdAlb3bxGuZ66W6elqxRGuIgr3wBNgGXhltqOqF2gQVH1Gq/sw P7rkbQv5Lwo31QOq62Fmze84NOh9gPTVYesnqGJXNgjYELoSrPMeHbwnTZ4w5JqBWDk1 g8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bur.io header.s=fm3 header.b=szxYHLzc; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=LRDXE0Wy; 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 u3si18651666plf.328.2021.04.13.15.08.07; Tue, 13 Apr 2021 15:08:20 -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; dkim=pass header.i=@bur.io header.s=fm3 header.b=szxYHLzc; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=LRDXE0Wy; 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 S232653AbhDMRZ0 (ORCPT + 99 others); Tue, 13 Apr 2021 13:25:26 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:47281 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232521AbhDMRZZ (ORCPT ); Tue, 13 Apr 2021 13:25:25 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 1F7CC5C0085; Tue, 13 Apr 2021 13:25:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 13 Apr 2021 13:25:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=FAxzhQis+VzV9EuRK6sBuAnym9g l5bJPLVFhKy7PrYc=; b=szxYHLzcBwBq9zApoa9+sFTJqxzBP/McWn5QbFp8NNE IRbzbidDyUzfVqgag70t527ZiyL0vrzWvKhodYD/rH8kBBaJ8aYTo6SCPD6mmam1 RrbQ52b9mFh1swiFMAya7WupYbp5nS3J62T32XWsFJFucoNWtjYsQmI68E/VjV/u mgWPzIiZvwzYFh2hmGxXRZHBFHk4ZLS5Om7BDWaFUmJXud6tQIXhCo2H3sGMEWki iauHVjV0i0Re3pUU4kL5sERZ1Npxzm1xbxase+qHlTXM4PY/I21++t2Ztw8HtmjS VEKqI7U4h5/jmRFpcMSg6lj2pFrKHJ+0fNhQLm0VBMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=FAxzhQ is+VzV9EuRK6sBuAnym9gl5bJPLVFhKy7PrYc=; b=LRDXE0WyZzif/OQ6WPaLAp AXMgVS5bzs1FJ3jek4+RPhcVCf/dMyleQXzrrhd18FJ1j0ukzvINWPLk4xBvmH6d sb72/nZrPpBhegYzl6mL17GmHfl5bRkufKBmWTGWiLBAp7sBpUBATaH1kUF6DvWq PURKmlGw8fSTPAc4Sao6FyITLy2xjWv0t9/TqI9EM0EnLpESHObEr08VN4Q7sd3V RFWRbvOk2LNNnvXXmlq+SeRKnXfs6/h3ynmMXmhamMggvPHD4DoqNZ8cBOzWvyc7 68Ky7Nk8k/XXc1DRrICrFqqCcVjjqMG29vdTlZVB2ivCgPQf7iz9JZokwBRzMT7Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudekledguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehorhhi shcuuehurhhkohhvuceosghorhhishessghurhdrihhoqeenucggtffrrghtthgvrhhnpe ehudevleekieetleevieeuhfduhedtiefgheekfeefgeelvdeuveeggfduueevfeenucfk phepvddtjedrheefrddvheefrdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Received: from localhost (unknown [207.53.253.7]) by mail.messagingengine.com (Postfix) with ESMTPA id EEEDE1080066; Tue, 13 Apr 2021 13:25:02 -0400 (EDT) Date: Tue, 13 Apr 2021 10:25:01 -0700 From: Boris Burkov 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: References: <20210413130604.11487-1-khaledromdhani216@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210413130604.11487-1-khaledromdhani216@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 02:06:04PM +0100, Khaled ROMDHANI wrote: > The variable zone is not initialized. It > may causes a failed assertion. > > Addresses-Coverity: ("Uninitialized variables") > > Signed-off-by: Khaled ROMDHANI Reviewed-by: Boris Burkov > --- > 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 eeb3ebe11d7a..ee15ab8dccb5 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; > > ASSERT(mirror < BTRFS_SUPER_MIRROR_MAX); Thanks for the fix. I assume this was dug up by coverity static analysis rather than hitting it in a live system? Since there is already an assert for the pre-condition 'mirror < max', I feel like it would make sense to also add one for mirror > 0. > switch (mirror) { > -- > 2.17.1 >