Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2116390imc; Tue, 12 Mar 2019 07:23:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoiOULyEKMBTqf3h/cCpwxSRjexIpmQ90Szvqek5o60I3SJHQq93MAdCFa7qJT4llBaPvJ X-Received: by 2002:a63:1014:: with SMTP id f20mr35802405pgl.293.1552400624188; Tue, 12 Mar 2019 07:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552400624; cv=none; d=google.com; s=arc-20160816; b=lQdDBcnJ+viTUppHdOVZ4SB+So41NBG6RSkrYE1XQkIDaRc0FHPvkjRhl/ik4hyowm LtqhpNPrY6CP75F/N3G2kMXkZT4UFxMan3rzcih0xtuVfd16WmwUHflM8KF6UWqgE6ox CwJfvsVj0FZ4iLRbhHhOsp+bJTNqic4mPkhNykF3QMLzdstGpF1GgjP5O9RZvr12Ul2/ a0Nt6g/XuJvaQwt5jT8T+rbm8u69jQ8xIeTVHOKQsaZo3uhhKdbmn+IUP7MiItyn5Ac1 qWIMUxKdJG1of39XQ4GRyFjjllXTxDyT9I0NzBONSeKqaL/8JqvnFbccKKJ7hKN1WaKi 2dFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0BJCbjU1mEDLSMrRF0D0Elb+HHs524er5I4ErihhaEo=; b=lgROQHQ3REIzR+ECRIwSjRiUo6lGDU5IIJmLssDmPAUSeObUpOPRdcgsbZXqLwByy7 H0Mzd1GTOTlm9nHyBhWRMvm81sytY1K0MfOMHmSNj0umaQqX7bwsU4YWhL51ktTONuuW pAzaJsivwiluY8SHPVZgA/4+EseSR9N8NWdO/AC+a9PISBfiPiYZU9ShSTZ2QnKufpJS n79goglkml6S3QBPA9l+7F6gp851To5XraANguIPzF0UV23N+e1CTH+9V6M6Su74kb6C ozdOTa9R44ijd/u03V0/B0G5WgE/L6pIxWhO1LN1MoyzOJ+ooiEkWszECNDEn0QxKoFg EtWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si6005137plc.233.2019.03.12.07.23.27; Tue, 12 Mar 2019 07:23:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbfCLOWG (ORCPT + 99 others); Tue, 12 Mar 2019 10:22:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34522 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbfCLOWG (ORCPT ); Tue, 12 Mar 2019 10:22:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F16DF307E044; Tue, 12 Mar 2019 14:22:05 +0000 (UTC) Received: from redhat.com (ovpn-122-134.rdu2.redhat.com [10.10.122.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CFB510018F9; Tue, 12 Mar 2019 14:22:04 +0000 (UTC) Date: Tue, 12 Mar 2019 09:22:02 -0500 From: Bill O'Donnell To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org, Nathan Chancellor , linux-kernel@vger.kernel.org, Nick Desaulniers , clang-built-linux@googlegroups.com Subject: Re: [PATCH 1/2] xfs: zero initialize highstale and lowstale in xfs_dir2_leaf_addname Message-ID: <20190312142202.GA28037@redhat.com> References: <20190311161948.GC4359@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190311161948.GC4359@magnolia> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 12 Mar 2019 14:22:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 11, 2019 at 09:19:48AM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > Smatch complains about the following: > > fs/xfs/libxfs/xfs_dir2_leaf.c:848 xfs_dir2_leaf_addname() error: > uninitialized symbol 'lowstale'. > > fs/xfs/libxfs/xfs_dir2_leaf.c:849 xfs_dir2_leaf_addname() error: > uninitialized symbol 'highstale'. > > I don't think there's any incorrect behavior associated with the > uninitialized variable, but as the author of the previous zero-init > patch points out, it's best not to be passing around pointers to > uninitialized stack areas. > > Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell > --- > fs/xfs/libxfs/xfs_dir2_leaf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c > index 9a3767818c50..2abf945e5844 100644 > --- a/fs/xfs/libxfs/xfs_dir2_leaf.c > +++ b/fs/xfs/libxfs/xfs_dir2_leaf.c > @@ -574,7 +574,7 @@ xfs_dir2_leaf_addname( > xfs_dir2_data_unused_t *dup; /* data unused entry */ > int error; /* error return value */ > int grown; /* allocated new data block */ > - int highstale; /* index of next stale leaf */ > + int highstale = 0; /* index of next stale leaf */ > int i; /* temporary, index */ > int index; /* leaf table position */ > struct xfs_buf *lbp; /* leaf's buffer */ > @@ -583,7 +583,7 @@ xfs_dir2_leaf_addname( > xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */ > int lfloglow; /* low leaf logging index */ > int lfloghigh; /* high leaf logging index */ > - int lowstale; /* index of prev stale leaf */ > + int lowstale = 0; /* index of prev stale leaf */ > xfs_dir2_leaf_tail_t *ltp; /* leaf tail pointer */ > int needbytes; /* leaf block bytes needed */ > int needlog; /* need to log data header */