From patchwork Fri Mar 8 00:34:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10844033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC0EF139A for ; Fri, 8 Mar 2019 00:34:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77F6628E98 for ; Fri, 8 Mar 2019 00:34:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6686A287D4; Fri, 8 Mar 2019 00:34:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 109E728763 for ; Fri, 8 Mar 2019 00:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbfCHAe0 (ORCPT ); Thu, 7 Mar 2019 19:34:26 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:36044 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbfCHAe0 (ORCPT ); Thu, 7 Mar 2019 19:34:26 -0500 Received: by mail-ed1-f66.google.com with SMTP id g9so15034940eds.3; Thu, 07 Mar 2019 16:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uzDbEfVZ0JKScB+VD8mAu8ZcFBVdjaYxgrBDjaB0nn4=; b=jJeOPnGQjXHIM2zOOmzam7TFLhCAAp+gn55olh1C5UbXQ7VUIy0qDyKImzxoYYJJOw 8xEvtWtPCPwCJLdtAEVpCgRNtjQ8y1UKHl3asOIdo7QnaFlsVZ4ES7q1IoyHNBI2ZnIR WtLZepoAlE/7Dk1/JT6Qw61rtrb/XytITeqqPwRO4e0VO0wkJ/0JvS2f6NgOe+XTXhG3 UFa3/HeGKrOcOoiEO0Am7o8omNJgNifrsREtqaJwFifNwPQrkb1tQCkIJu61JrDN1XPx t+kLCctAgh+HvTfFLoAkbwuOIlTVti2+3dIhDoplfD2qe91ib/+b6KtkjqBHnkMHJFqy JYHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uzDbEfVZ0JKScB+VD8mAu8ZcFBVdjaYxgrBDjaB0nn4=; b=mhvM1jaSNZNO9tXsOWwCbU6ZR6Y9j31Q4TOmUNrV5RcSfP7YflXY2WU0S5+RCi/KOX 34JC9l8/L2wR+klPaqngIvYOAfEF/UPM7bSBLpNh5U6voIccVXsbXGboewKOGP1P3Ucs K92BM56S/c/EAIGGRGO3iGYBjnyVt8yggSa3kBvTDl01i0467gWuJLMWxRfFfVG8klZn pGc1msgG8gSsNVtB+nzFlSVrORPyvoB4VXcWTk5d8jeLJKdi8PbleUEh8fTNMADxWrgB 2sNc6JgK1bhAj8c6BbclUltLfiFwoNYkYWNUT8U7ReCt+RSD/yjB7RZNCeBUdNpToK70 jGpg== X-Gm-Message-State: APjAAAULY8gOyiFusRdXNjume5NYiB6GhqUpSbwiu3w5eSU9Hqrhrd2U VJTeg9LIOmjVt4y+4j4JXYI= X-Google-Smtp-Source: APXvYqzKfKxWW+sLft20azD1DIH1II0QkoCKDIdHrg4ZWqd/5Iuou6qE8kmo2HM3JgA12QuXXQbf2w== X-Received: by 2002:a17:906:3d7:: with SMTP id c23mr9698330eja.138.1552005263829; Thu, 07 Mar 2019 16:34:23 -0800 (PST) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id i19sm1135241ejh.44.2019.03.07.16.34.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 16:34:23 -0800 (PST) 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, Nathan Chancellor Subject: [PATCH] xfs: Zero initialize highstale and lowstale in xfs_dir2_leafn_add Date: Thu, 7 Mar 2019 17:34:13 -0700 Message-Id: <20190308003413.25068-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When building with -Wsometimes-uninitialized, Clang warns: fs/xfs/libxfs/xfs_dir2_node.c:481:6: warning: variable 'lowstale' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] fs/xfs/libxfs/xfs_dir2_node.c:481:6: warning: variable 'highstale' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] While it isn't technically wrong, it isn't a problem in practice because highstale and lowstale are only initialized in xfs_dir2_leafn_add when compact is not zero then they are passed to xfs_dir3_leaf_find_entry, where they are initialized before use when compact is zero. Regardless, it's better not to be passing around uninitialized stack memory so zero initialize these variables, which silences this warning. Link: https://github.com/ClangBuiltLinux/linux/issues/393 Signed-off-by: Nathan Chancellor Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_dir2_node.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c index 3b03703c5c3d..de46f26c5292 100644 --- a/fs/xfs/libxfs/xfs_dir2_node.c +++ b/fs/xfs/libxfs/xfs_dir2_node.c @@ -444,6 +444,8 @@ xfs_dir2_leafn_add( dp = args->dp; leaf = bp->b_addr; + highstale = 0; + lowstale = 0; dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); ents = dp->d_ops->leaf_ents_p(leaf);