xfs
[Top] [All Lists]

Re: [PATCH] xfs_check: fix test for too-high level in v2 dir node

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfs_check: fix test for too-high level in v2 dir node
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Wed, 18 Sep 2013 14:35:34 -0500
Cc: "'linux-xfs@xxxxxxxxxxx'" <linux-xfs@xxxxxxxxxxx>
Delivered-to: linux-xfs@xxxxxxxxxxx
In-reply-to: <52322B67.80305@xxxxxxxxxx>
References: <52322B67.80305@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 09/12/13 16:00, Eric Sandeen wrote:
The test as it stands allows level == XFS_DA_NODE_MAXDEPTH (5),
but a max depth of 5 equates to level values of 0 through 4.

Level 5 would be a depth of 6.

Signed-off-by: Eric Sandeen<sandeen@xxxxxxxxxx>
---


diff --git a/db/check.c b/db/check.c
index cbe55ba..d9e3e3f 100644
--- a/db/check.c
+++ b/db/check.c
@@ -3138,7 +3138,7 @@ process_leaf_node_dir_v2_int(
        case XFS_DA_NODE_MAGIC:
                node = iocur_top->data;
                xfs_da3_node_hdr_from_disk(&nodehdr, node);
-               if (nodehdr.level<  1 || nodehdr.level>  XFS_DA_NODE_MAXDEPTH) {
+               if (nodehdr.level<  1 || nodehdr.level>= XFS_DA_NODE_MAXDEPTH) {
                        if (!sflag || v)
                                dbprintf(_("bad node block level %d for dir ino 
"
                                         "%lld block %d\n"),


I think the current code is correct.

0 is a leaf. levels 1-XFS_DA_NODE_MAXDEPTH are nodes.
Subtract 1 when used as an index.

--Mark.



<Prev in Thread] Current Thread [Next in Thread>