public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs mailing list <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs_db: do bounds checking in frag's scanfunc_bmap
Date: Fri, 31 Jul 2009 16:43:39 -0400	[thread overview]
Message-ID: <20090731204339.GA31179@infradead.org> (raw)
In-Reply-To: <4A708247.7040509@sandeen.net>

> @@ -437,15 +437,29 @@ scanfunc_bmap(
>  	int			i;
>  	xfs_bmbt_ptr_t		*pp;
>  	xfs_bmbt_rec_t		*rp;
> +	int			nrecs;
> +
> +	nrecs = be16_to_cpu(block->bb_numrecs);
>  
>  	if (level == 0) {
> +		if (nrecs > mp->m_bmap_dmxr[0]) {
> +			dbprintf(_("invalid numrecs (%u) in %s block\n"),
> +				   nrecs, typtab[btype].name);
> +			return;
> +		}
>  		rp = XFS_BMBT_REC_ADDR(mp, block, 1);
>  		process_bmbt_reclist((xfs_bmbt_rec_32_t *)rp, 
> -				be16_to_cpu(block->bb_numrecs), extmapp);
> +				nrecs, extmapp);
> +		return;
> +	}
> +
> +	if (nrecs > mp->m_bmap_dmxr[1]) {
> +		dbprintf(_("invalid numrecs (%u) in %s block\n"),
> +			   nrecs, typtab[btype].name);
>  		return;
>  	}
>  	pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[0]);
> -	for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
> +	for (i = 0; i < nrecs; i++)
>  		scan_lbtree(be64_to_cpu(pp[i]), level, scanfunc_bmap, extmapp, 
>  									btype);
>  }

Looks good to me.


Reviewed-by: Christoph Hellwig <hch@lst.de>

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

      reply	other threads:[~2009-07-31 20:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 17:09 [PATCH] xfs_db: do bounds checking in frag's scanfunc_bmap Eric Sandeen
2009-07-31 20:43 ` Christoph Hellwig [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=20090731204339.GA31179@infradead.org \
    --to=hch@infradead.org \
    --cc=sandeen@sandeen.net \
    --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