Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1262377imc; Mon, 11 Mar 2019 09:48:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwE658d0nj1ARqaMzMbCOB7oTRPMtFAD+ua2Pe4QIZjPNWQRfYGrCdDDiHtdDcXTXZVZQfD X-Received: by 2002:a65:4785:: with SMTP id e5mr10269671pgs.353.1552322910750; Mon, 11 Mar 2019 09:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552322910; cv=none; d=google.com; s=arc-20160816; b=nSRzOWKZHD3z5Tfdkw/m8N+tu2UDVR2LBZebMp8JMHvJ8p6HtzahO76e5I48g4h7ig 8ucnPe6dn/ms2sORWHM8NRm1GSzUAZ7LKXktnXeVc3CcAkYbdytcJQUG5AxwrEjc7snl sg2YSxjXM2NUFgoqJB7MS059pwDcHo7hBUQdj8AL50GxerIrGS9BvOOcLfgJPH8VznQz MFl4P3oa60ZjulX3eAIVs6dxGqYRuh8sWHG3BGz7J/xthIPpABzQ/4L/dRxx7CJYJ0Iw dNZ+COrnq3BYlE9VjIPQqjOIFO+dsiJcFS01Ht71vFu9nhMCE85d+7ee/e/J9uolRPqq 0VoQ== 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:dkim-signature; bh=kkf/Ijrme+opCg1UsdMKL4AypLjy9oSWPmvyVp+1AaY=; b=k/oXSRYD0LQrocqi0FUQuX3e6drJQbDz1/Jgb+BNQz4rmkdolg1A3HZ4hapGBYTbm0 j0tmUQ14/uMOiA3VIjMfT77JUTSPnQCjzcHBlJxlU7WCRv09O7elWZ63b3o8wV32okQi SZse5Ex7c+nszRwgDqx8WtJApwcZOiposbzGiNzPzIpu1caDOo+5XpFXH/Z9YafWrdRM Ahtrrn21/koENJO+4JaTDZKTkEIOBl+vh8Zf4vG5EAooG9h2faECdu/DE00fqRz59VLy TZ9JwYW1y6H2lvOyQGKbbh4rElvyxzQKiJ4wVx3Ne0+R67ZLZDMlKdoQP6X5TfJwjiGf D20A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R52MJref; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d68si5367000pgc.538.2019.03.11.09.48.14; Mon, 11 Mar 2019 09:48:30 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R52MJref; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727796AbfCKQqV (ORCPT + 99 others); Mon, 11 Mar 2019 12:46:21 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:39983 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfCKQqV (ORCPT ); Mon, 11 Mar 2019 12:46:21 -0400 Received: by mail-ed1-f66.google.com with SMTP id r23so2109914edm.7; Mon, 11 Mar 2019 09:46:20 -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=kkf/Ijrme+opCg1UsdMKL4AypLjy9oSWPmvyVp+1AaY=; b=R52MJrefkdEzuQ8cmYOEzgF9J9lGWW4f5VqG57Wrc4LcJQv0SGqVbvmlga76A1SSZg 5VE0y09Dp6+wgYsNyhPtorn7MC0MPuAu31MeQHQ9tYE7wk4xeDkj6WCoaLBS6jOpUTNo CCTEMTLFcpJDwb1XplMB+bA6cSww65n9CSQsYWq83NbZ3yoEzLL2kfld4IBYjCdzmv9I FbOKk8JpUm1wnIiYDW9XTd1oipr1N6GKRyW+kNo+6RI9RiCC+H11+hHH082tsrG3WNJH 6g2b5pXDePYVUDEiNJCY8Tb+hy0kDnkteQ0B2z0ihvv0iWqqbGuCOdJE3ndJF8gndGU6 gqdA== 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=kkf/Ijrme+opCg1UsdMKL4AypLjy9oSWPmvyVp+1AaY=; b=eGlABLOX4SlgqLwErFkvVClbVwAW0kkFlv2/5oFf0qdPXyLS4CYvZWLVahlarMHduh 0CmaMpmFlqKyaodCZCZjy9Uo1dT1aXmpnAzgwwj9jjKdPvXZ/BwmsKPLHr7EQYJvecVx PeciRJdXa0wtbrQTj9+Ij5t+ie7eBmQ0SZNOvA17KcSdsld2R+lW8sx+xCt9bl1Ygsne TutainXtfpXlxfWqoPHeKeXBLfjPULKZixXbojCZgnl6NvvMb3kpcdi8cRHoTpaOPc8B h1TkHiOGwSfW2fXGa3ZsUy5Wb811O/4busMecHCcyHhPUtsU4C5qDDK86FdO0d0vwo3N SuFw== X-Gm-Message-State: APjAAAV6/RnSfnlKx8haLN+SS2m8Cuj5uvRrfM+tJrpODe0TDKlqXpII L72O7EZMd0LIbxTKsTFx1iQ= X-Received: by 2002:a05:6402:1352:: with SMTP id y18mr44341968edw.76.1552322779118; Mon, 11 Mar 2019 09:46:19 -0700 (PDT) Received: from archlinux-ryzen ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id k14sm4781836edb.51.2019.03.11.09.46.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 11 Mar 2019 09:46:18 -0700 (PDT) Date: Mon, 11 Mar 2019 09:46:16 -0700 From: Nathan Chancellor To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org, 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: <20190311164616.GA14469@archlinux-ryzen> 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) 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: Nathan Chancellor Thanks for this! > --- > 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 */