[PATCH] fix overflow in xfs_growfs_data_private

Christoph Hellwig hch at infradead.org
Mon May 25 05:15:29 CDT 2009


On Sat, May 23, 2009 at 02:30:12PM -0500, Eric Sandeen wrote:
> Index: linux-2.6/fs/xfs/xfs_fsops.c
> ===================================================================
> --- linux-2.6.orig/fs/xfs/xfs_fsops.c
> +++ linux-2.6/fs/xfs/xfs_fsops.c
> @@ -160,7 +160,7 @@ xfs_growfs_data_private(
>  	nagcount = new + (nb_mod != 0);
>  	if (nb_mod && nb_mod < XFS_MIN_AG_BLOCKS) {
>  		nagcount--;
> -		nb = nagcount * mp->m_sb.sb_agblocks;
> +		nb = (xfs_rfsblock_t)nagcount * mp->m_sb.sb_agblocks;
>  		if (nb < mp->m_sb.sb_dblocks)
>  			return XFS_ERROR(EINVAL);

Nice one! Thanks dear C integer promotion rules..

Would be good to get this into 2.6.30


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




More information about the xfs mailing list