Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp359730pxy; Fri, 30 Apr 2021 07:03:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmUqF5BG0u2AZ2+BGBLtqw6F/tWX534l7Z6Mf8OLOznssVrUzQ6VS1G7TApBVR+IYX9hrc X-Received: by 2002:a63:4f50:: with SMTP id p16mr4802027pgl.40.1619791381871; Fri, 30 Apr 2021 07:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619791381; cv=none; d=google.com; s=arc-20160816; b=v7A9Sl5em6/FpUhbHu1OGFdMeKf/xqae8uKqZIRz46Nosm+UbBKygbnO94x1QrYadb gKMc5GKs2n9fcVKaaCITp+TAWnEbRF9VKb+igZlUGV+iGS0dUUYfOYiLDjP6MPcG45PG o3TrIHE73fYbDH3F09BL7tVMkhLnObsNEQd9qguSTmDD3XRV/WJm1wXA2Ry4Crwntdyq 1qrBEC4cOf/YSS+ZUDEV+5uDSv7/vb0372QVRUA9DG1MjCdX8dQGzoKJCRDngfgY2Wem rGOy8V67lUz45CCQeeCGhEQu/qaEH3Pkgklef+5sR9V7Y4D3tArgO2GztUWEEeRh3LdG uWZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5vc51MIOvLctgKvPzN3X1mUUyH1WiwVtt6VoY2lKmIg=; b=L0vnNmAscYa2eGA1pv6uOIVa3oZ7//7vSZv2QL7nVo6Scyfa7Lv26htTJsS1aRqYuz vPQj3+CIgmtumJXjSLgR4HVnJcUyEgvtYT8xoyx6YFWpOx+w85zObxtYjYRnpfTxbGHh kVXvT26iSaKw1BME4F19tGziNxmepLmIMBr8TMOfYVRQVm8H9SCGslDkhABLBl/69tgq JVwDl/rVfFRLfV+K8MS7etw/utYyrxazVsljiQ+AcX/v2eF/WodJHDdS6zu1oWhuhbHz 2XGQDBDjJmGZmV1qlKgKiH+4FsqRTrF7auuQWtWFF2m8eycRWuP4Hmc/ypEWmot8mbIK rAfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VbA61w2h; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p6si3640936plq.109.2021.04.30.07.02.46; Fri, 30 Apr 2021 07:03:01 -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=@gmail.com header.s=20161025 header.b=VbA61w2h; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232618AbhD3OCY (ORCPT + 99 others); Fri, 30 Apr 2021 10:02:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbhD3OCX (ORCPT ); Fri, 30 Apr 2021 10:02:23 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1191C06174A; Fri, 30 Apr 2021 07:01:33 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id q9so16564247wrs.6; Fri, 30 Apr 2021 07:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5vc51MIOvLctgKvPzN3X1mUUyH1WiwVtt6VoY2lKmIg=; b=VbA61w2htAGnFT9KN73WgAFCB0NLUfzr7aBiY3RofMEiKmASSUrz05sMXrgGDJFq8L OuS1EmiR71yp2X68S/udpJIND6QFEVC32oxVQLMh9x+IAQmCKqitTCY+zX5yKLNOeN8/ STJ7IvvIRMdIbV7Bo9q6Uxc4YEF4NfSfwBd05pfini65Q3lb7Pt0tcNMfWbGRykh2cJ0 XnmNog+iMSOjAT4Bw7i1yqfHyk4ZQg+rYaV6uhcSlNlyW/W4mvhRWNwEBj4cRD7nlkzk xElItMyaRz8/ncdZemYyjG0zhGswcQcdLYzGmIQxTaSGi3XV53cLyW4BNtGEGmNGmal6 F6QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5vc51MIOvLctgKvPzN3X1mUUyH1WiwVtt6VoY2lKmIg=; b=A3xgVFUSacnkhaDeTbs/1Yf5o6jpMVfeLX7aoR1vKveU1MSPqZM6/rATi1V3biMJ44 fDSjWU5iEHh/T/tYTkRK35ndnEMZN+yFST+P/NgeNqcmh9zypXc0++Fl0YfHByzpGaBX 2VhLCOaNZJiYajd0ZZqbQWj0WQwugqJIBNcuJj4JiyEqO1iSA2PQtHh3YYr7vrcrvbtB u7zCGPIGtMFFBecYnwPzDxOOlTs8NBcbX7TNxRQe+wVRN7HQEC4BJn+2fL4Y0jJL+S9t cX/p6XEh7YxwQSRJNEOpSkJfc2f5nx/aZIDOCZaPb2i5AAmET/tpmN3zYrqCVq1fR5fy v0+g== X-Gm-Message-State: AOAM531/1+FbhNybFSMjAmO1NdEDo2Um+g8N5lkVZCIMglXqpELFBP1B vwxKXNRa52cTO7I9yPfdafs= X-Received: by 2002:adf:fd0b:: with SMTP id e11mr7067713wrr.402.1619791292411; Fri, 30 Apr 2021 07:01:32 -0700 (PDT) Received: from ard0534 ([41.62.193.191]) by smtp.gmail.com with ESMTPSA id j13sm2318262wrw.93.2021.04.30.07.01.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Apr 2021 07:01:31 -0700 (PDT) Date: Fri, 30 Apr 2021 15:01:28 +0100 From: Khaled Romdhani To: Dan Carpenter 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-V2] fs/btrfs: Fix uninitialized variable Message-ID: <20210430140128.GA2565@ard0534> References: <20210427171627.32356-1-khaledromdhani216@gmail.com> <20210429141200.GB1981@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210429141200.GB1981@kadam> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 29, 2021 at 05:12:00PM +0300, Dan Carpenter wrote: > On Tue, Apr 27, 2021 at 06:16:27PM +0100, Khaled ROMDHANI wrote: > > The variable 'zone' is uninitialized which > > introduce some build warning. > > > > Reported-by: kernel test robot > > Signed-off-by: Khaled ROMDHANI > > --- > > v2: catch the init as an assertion > > --- > > 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..70c0b1b2ff04 100644 > > --- a/fs/btrfs/zoned.c > > +++ b/fs/btrfs/zoned.c > > @@ -144,7 +144,7 @@ static inline u32 sb_zone_number(int shift, int mirror) > > case 1: zone = 1ULL << (BTRFS_SB_LOG_FIRST_SHIFT - shift); break; > > case 2: zone = 1ULL << (BTRFS_SB_LOG_SECOND_SHIFT - shift); break; > > default: > > - ASSERT(zone); > > + ASSERT(zone = 0); > > I'm sorry but this doesn't make any kind of sense. > > > break; > > } > > regards, > dan carpenter > The idea behind this is to force the assertion failure in default when no valid 'mirror' value was entered. But as all caller pass valid mirror values, this case will not happen. So, I just fix the warning of the uninitialized variable 'zone' as reported by the kernel test robot. Thus I guarantee the failure when 'mirror' was invalid. If I am wrong, please clarify. Thanks.