Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3359947pxb; Tue, 20 Apr 2021 06:42:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH781WvBvgkQO6x9IpELHWzKtZR3FvT+0nZgIUYlJxJqBwpi14B5ScuxIo4JnAJrpO1DGk X-Received: by 2002:a17:906:9bd3:: with SMTP id de19mr26817468ejc.329.1618926165877; Tue, 20 Apr 2021 06:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618926165; cv=none; d=google.com; s=arc-20160816; b=gSAK61jRxV2MorJtQanv+0tBZKRvhjFWPjP4IO8tMPDqSHxbUMNo8k33oNePBYfHW0 J0OgxSk4BwXirNQSwDBacNRQiS37nJ72zBlH2K2951h4l5tmgkMH6X16yJP/hcPfpJcD oKqiOcPQb0l/hEnvXUuaf650ueJQvxQbs16c+YFqTsvcxh5JmUv7HHlQCMNYHqGs83Tx +ypIGOdzZHq7c0GTn5WegFIy4C83QE5OCJNhtmmJ2hJ36t17nALWhHJ022NZDtHnvjjt hH0QRc58/bQzvZ4XNsl07Cu69cpUpTnQSAH/BkPfI/w48FQn3sKeMd7rnQp3C00F4uG7 DS3w== 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=Cz/GOpaJvoOGO7WnzoMrMyjou+pDiBvr8VXW+xJYUMQ=; b=ym0ztZEBqSY2LijVqllk2O4Ddb48VFXzoX/+2a5z6+QBVOXmQSkkzqONQqc03B8kdz dxiJtgqKmnHXaY5O/kWnOryWarAWewLPWs06zLtrVFCqQ3xx/a+shb5mz0hTZU9kS78P 5rH9+3saphvVxXwnz2J5VssVgXcHMHSTj1hucHE+X4IarLIgEmXiz2kWAfy5lC95xIMo R/HUGLjYWxiFW43sX1FMX73QucUNI+TqrVJ6584Y/80Toe0IgRNGpd0FfnkEOdhBzTyv kcmBO4jQiSme0ezUyHII56pQjbq3IZINqePYjhrd8tWGQenMS5crm77EgiRsAD1cDRi1 ZNxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mjpOW1au; 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 f4si15708200eja.638.2021.04.20.06.42.22; Tue, 20 Apr 2021 06:42:45 -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=mjpOW1au; 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 S232558AbhDTNj7 (ORCPT + 99 others); Tue, 20 Apr 2021 09:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbhDTNj5 (ORCPT ); Tue, 20 Apr 2021 09:39:57 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B0C4C06174A; Tue, 20 Apr 2021 06:39:26 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id j5so36689918wrn.4; Tue, 20 Apr 2021 06:39:26 -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=Cz/GOpaJvoOGO7WnzoMrMyjou+pDiBvr8VXW+xJYUMQ=; b=mjpOW1aupBAvxnwb3M+g0xZ0S7X3rHPTCLpZYQ06tU4qDYyr4hnCxjdz/lGWmRUGrI 1Mx3OmIosZti9cq5AUDrXQWcyyXzF6XD/4paZ6IvUDspMmuN0SoVr7/aTxuLT7HRL0fX SBtInp6BzbRERCBzzSrr1mujnACI1op9RvjOtUN+3b+WfN7DS+l3/F+tJxxhsoUPl6JE AqnMIj44/rqmxFhbV9dbUPqXK+irNLh1cndo1acVFwTMhzqumIlPbVDAMlMApTOU57rX d+geiGMxZJZwdxy+Czdt8iZvhX3uwp2/r+juuGUSPuQ668g27tz27crtTSW8fYMUkjgI TVZg== 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=Cz/GOpaJvoOGO7WnzoMrMyjou+pDiBvr8VXW+xJYUMQ=; b=c1WeYj85hHMI0YgLurBEPyekq8qK+O0Dfgv6I2ya4+fBUl94+oeY0wzA5I/kxoHZ1k ooAozXxX/oKGG36T1ptMvYSKOLjsPAUGFoj1JdIep1ycdEQ1W82fMIdLrrTrw3clMc59 FjZI/BHAE8s6B9axeAF23Q8ENEg844nawIR1r2k5S7ii8V6lAK8n1mpNSqR/tSxoSSfm xZVEpOqp0N6XTM4GOcv6TrcAAZgnC7SpOxgYTpqi5DbTghZ0aMNbr4JKkyYibIdwhCke 0Bg9O3Bsas2d8Vo+2FlBGj/5QFpXAEEnSe09u98uCjYagv5R9nXzLamxj78GbFkoG06v j2tg== X-Gm-Message-State: AOAM533LVBAkTeTTFZM5FuWnvbiZ30uO69qGOND+83xaZfPKHKb8IpKa RN1K2E56dDjt6KwtgJ36erY= X-Received: by 2002:adf:e2cc:: with SMTP id d12mr15334857wrj.90.1618925964849; Tue, 20 Apr 2021 06:39:24 -0700 (PDT) Received: from ard0534 ([197.240.34.190]) by smtp.gmail.com with ESMTPSA id q5sm3523570wmj.20.2021.04.20.06.39.23 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Apr 2021 06:39:24 -0700 (PDT) Date: Tue, 20 Apr 2021 14:39:21 +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, khaledromdhani216@gmail.com Subject: Re: [PATCH v2] fs/btrfs: Fix uninitialized variable Message-ID: <20210420133921.GB3433@ard0534> References: <20210417153616.25056-1-khaledromdhani216@gmail.com> <20210420102214.GA1981@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210420102214.GA1981@kadam> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 20, 2021 at 01:22:14PM +0300, Dan Carpenter wrote: > On Sat, Apr 17, 2021 at 04:36:16PM +0100, Khaled ROMDHANI wrote: > > As reported by the Coverity static analysis. > > The variable zone is not initialized which > > may causes a failed assertion. > > > > Addresses-Coverity: ("Uninitialized variables") > > Signed-off-by: Khaled ROMDHANI > > --- > > v2: add a default case as proposed by David Sterba > > --- > > fs/btrfs/zoned.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > > index eeb3ebe11d7a..82527308d165 100644 > > --- a/fs/btrfs/zoned.c > > +++ b/fs/btrfs/zoned.c > > @@ -143,6 +143,9 @@ static inline u32 sb_zone_number(int shift, int mirror) > > case 0: zone = 0; break; > > case 1: zone = 1ULL << (BTRFS_SB_LOG_FIRST_SHIFT - shift); break; > > case 2: zone = 1ULL << (BTRFS_SB_LOG_SECOND_SHIFT - shift); break; > > It took me a while to spot these break statements. > > > + default: > > + zone = 0; > > + break; > > This break needs to be indented one more tab. > > > } > > > > ASSERT(zone <= U32_MAX); > > regards, > dan carpenter Sorry, but I checked the patch using checkpatch.pl before sending it. Is that blocks some smatch parsing process? In any cases, I will send a V3. Thanks.