lkml.org 
[lkml]   [2007]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/9] Factor common inode cluster buffer lookup code
On Thu, Nov 22, 2007 at 11:36:42AM +1100, David Chinner wrote:
> +STATIC int
> +xfs_ino_to_imap(
> + xfs_mount_t *mp,
> + xfs_trans_t *tp,
> + xfs_ino_t ino,
> + xfs_imap_t *imap,
> + uint imap_flags)
> +{
> + int error;
> +
> + error = xfs_imap(mp, tp, ino, imap, imap_flags);
> + if (error) {
> + cmn_err(CE_WARN, "xfs_ino_to_imap: xfs_imap() returned an "
> + "error %d on %s. Returning error.",
> + error, mp->m_fsname);
> + return error;
> + }
> +
> + /*
> + * If the inode number maps to a block outside the bounds
> + * of the file system then return NULL rather than calling
> + * read_buf and panicing when we get an error from the
> + * driver.
> + */
> + if ((imap->im_blkno + imap->im_len) >
> + XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
> + xfs_fs_cmn_err(CE_ALERT, mp, "xfs_ino_to_imap: "
> + "(imap->im_blkno (0x%llx) + imap->im_len (0x%llx)) > "
> + " XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) (0x%llx)",
> + (unsigned long long) imap->im_blkno,
> + (unsigned long long) imap->im_len,
> + XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
> + return XFS_ERROR(EINVAL);
> + }

What about just adding this verification to xfs_imap instead of creating
this wrapper for two of it's three callers?

Otherwise this patch looks fine to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-23 18:43    [W:0.043 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site