xfs
[Top] [All Lists]

[PATCH] Check block magic number so we scan only valid blocks.

To: xfs@xxxxxxxxxxx
Subject: [PATCH] Check block magic number so we scan only valid blocks.
From: Peter Watkins <treestem@xxxxxxxxx>
Date: Thu, 8 Jul 2010 15:20:50 -0400
Cc: Peter Watkins <treestem@xxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=WD/NQd01KDFHKhXowIxjedKO4pMy0UimCGlonPliV6Y=; b=EC2ZYnQwBjhgsFGRNrCdIEXLBiyJZD2Z4T3mqV/1oOTPl3Y3+iPLtGWbGLa4WlT1Jd GxPV+nC6hENpdN/z0E2yXRP1dm+tIpSK/W2BCmI/S2+jJ+h3xI527hnvB1GqB7tblrBo PXKzqWIcE3zmV9QkFVSn8oHoG/KDY6x9Hh8wo=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=XV+A47gbzHX5Inp801pIp0PQVaB5TQExkhKo2P70ArZnM9wDeuV6G1RwqSsfNwUA1q 9q+h5YoRzs0K3pLMlW4ja/zBEOvwRL6a4R3R98BzbLeZJaK5CXK69s3KUuLaT776ywgv d6/vdLfy26F5BCatM92JlwQtnrbVNsurZMIWo=
In-reply-to: <20100707235218.GA30851@xxxxxxxxxxxxx>
References: <20100707235218.GA30851@xxxxxxxxxxxxx>
OK, thanks for taking a look.

Here's the complete patch in case anyone is interested.

 -Peter

Signed-off-by: Peter Watkins <treestem@xxxxxxxxx>
---
 db/freesp.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/db/freesp.c b/db/freesp.c
index e1902c6..c4dabad 100644
--- a/db/freesp.c
+++ b/db/freesp.c
@@ -286,6 +286,9 @@ scanfunc_bno(
        xfs_alloc_ptr_t         *pp;
        xfs_alloc_rec_t         *rp;
 
+       if (be32_to_cpu(block->bb_magic) != XFS_ABTB_MAGIC)
+               return;
+
        if (level == 0) {
                rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
                for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
@@ -310,6 +313,9 @@ scanfunc_cnt(
        xfs_alloc_ptr_t         *pp;
        xfs_alloc_rec_t         *rp;
 
+       if (be32_to_cpu(block->bb_magic) != XFS_ABTC_MAGIC)
+               return;
+
        if (level == 0) {
                rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
                for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
-- 
1.6.0.4

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