public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Watkins <treestem@gmail.com>
To: xfs@oss.sgi.com
Cc: Peter Watkins <treestem@gmail.com>
Subject: [PATCH] Check block magic number so we scan only valid blocks.
Date: Thu,  8 Jul 2010 15:20:50 -0400	[thread overview]
Message-ID: <1278616850-32451-1-git-send-email-treestem@gmail.com> (raw)
In-Reply-To: <20100707235218.GA30851@infradead.org>

OK, thanks for taking a look.

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

 -Peter

Signed-off-by: Peter Watkins <treestem@gmail.com>
---
 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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2010-07-08 19:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 15:09 [PATCH] Check block magic number so we scan only valid blocks Peter Watkins
2010-07-07 23:52 ` Christoph Hellwig
2010-07-08 19:20   ` Peter Watkins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1278616850-32451-1-git-send-email-treestem@gmail.com \
    --to=treestem@gmail.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox