We've already calculated the size of the short form directory in the size variable when checking if it fits. Use that for the temporary buffer allocation instead of overallocating to the inode size. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- fs/xfs/libxfs/xfs_dir2_sf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c index fad3fd28175368..d02f1ddb1da92c 100644 --- a/fs/xfs/libxfs/xfs_dir2_sf.c +++ b/fs/xfs/libxfs/xfs_dir2_sf.c @@ -281,11 +281,11 @@ xfs_dir2_try_block_to_sf( trace_xfs_dir2_block_to_sf(args); /* - * Allocate a temporary destination buffer the size of the inode to - * format the data into. Once we have formatted the data, we can free - * the block and copy the formatted data into the inode literal area. + * Allocate a temporary destination buffer to format the data into. + * Once we have formatted the data, we can free the block and copy the + * formatted data into the inode literal area. */ - sfp = kmalloc(mp->m_sb.sb_inodesize, GFP_KERNEL | __GFP_NOFAIL); + sfp = kmalloc(size, GFP_KERNEL | __GFP_NOFAIL); memcpy(sfp, &sfh, xfs_dir2_sf_hdr_size(sfh.i8count)); /* -- 2.39.2