From patchwork Wed Oct 10 20:01:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10635193 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 96DA469BB for ; Wed, 10 Oct 2018 20:01:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9429D2ACBB for ; Wed, 10 Oct 2018 20:01:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84D8D2ACF4; Wed, 10 Oct 2018 20:01:43 +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=-7.9 required=2.0 tests=BAYES_00,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 3F54C2ACF1 for ; Wed, 10 Oct 2018 20:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727563AbeJKDZX (ORCPT ); Wed, 10 Oct 2018 23:25:23 -0400 Received: from sandeen.net ([63.231.237.45]:56204 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727790AbeJKDZV (ORCPT ); Wed, 10 Oct 2018 23:25:21 -0400 Received: by sandeen.net (Postfix, from userid 500) id E08D8791F; Wed, 10 Oct 2018 15:01:24 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 17/18] xfs_metadump: remove shadow variable Date: Wed, 10 Oct 2018 15:01:21 -0500 Message-Id: <1539201682-22198-18-git-send-email-sandeen@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1539201682-22198-1-git-send-email-sandeen@redhat.com> References: <1539201682-22198-1-git-send-email-sandeen@redhat.com> 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 "length" is used in 2 nested inner scopes, which is fairly unclear and generates a sparse warning. Rename the inner scope variable for clarity. Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- db/metadump.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index cc2ae9a..8b8e472 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -1515,9 +1515,10 @@ process_dir_data_block( dup = (xfs_dir2_data_unused_t *)ptr; if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { - int length = be16_to_cpu(dup->length); - if (dir_offset + length > end_of_data || - !length || (length & (XFS_DIR2_DATA_ALIGN - 1))) { + int free_length = be16_to_cpu(dup->length); + if (dir_offset + free_length > end_of_data || + !free_length || + (free_length & (XFS_DIR2_DATA_ALIGN - 1))) { if (show_warnings) print_warning( "invalid length for dir free space in inode %llu", @@ -1527,15 +1528,15 @@ process_dir_data_block( if (be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) != dir_offset) return; - dir_offset += length; - ptr += length; + dir_offset += free_length; + ptr += free_length; /* * Zero the unused space up to the tag - the tag is * actually at a variable offset, so zeroing &dup->tag * is zeroing the free space in between */ if (zero_stale_data) { - int zlen = length - + int zlen = free_length - sizeof(xfs_dir2_data_unused_t); if (zlen > 0) {