xfs: initialize the shortform attr header padding entry
PATCH v2 1/1 xfs: initialize the shortform attr header padding entry
From: Darrick J. Wong <[email protected]>
Don't leak kernel memory contents into the shortform attr fork.
Signed-off-by Darrick J. Wong <[email protected]>
---
v2: memset instead of setting padding by hand
--- fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_attr_leaf.c +2 -2
@@ -653,8 +653,8 @@ xfs_attr_shortform_create(ASSERT (ifp->if_flags &XFS_IFINLINE ); }xfs_idata_realloc (dp,sizeof (*hdr),XFS_ATTR_FORK ); - hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; - hdr->count =0 ; + hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; +memset (hdr,0 ,sizeof (*hdr)); hdr->totsize =cpu_to_be16 (sizeof (*hdr));xfs_trans_log_inode (args->trans, dp,XFS_ILOG_CORE |XFS_ILOG_ADATA ); }
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Don't leak kernel memory contents into the shortform attr fork.
Signed-off-by Darrick J. Wong <[email protected]>---
v2: memset instead of setting padding by hand
yeah I think that's good.
Reviewed-by Eric Sandeen <[email protected]>
Quoted 20 lines
--- fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/xfs/libxfs/xfs_attr_leaf.c +2
-2@@ -653,8 +653,8 @@ xfs_attr_shortform_create(ASSERT (ifp->if_flags &XFS_IFINLINE ); }xfs_idata_realloc (dp,sizeof (*hdr),XFS_ATTR_FORK ); - hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; - hdr->count =0 ; + hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; +memset (hdr,0 ,sizeof (*hdr)); hdr->totsize =cpu_to_be16 (sizeof (*hdr));xfs_trans_log_inode (args->trans, dp,XFS_ILOG_CORE |XFS_ILOG_ADATA ); }
Quoted 16 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Don't leak kernel memory contents into the shortform attr fork.
Signed-off-by Darrick J. Wong <[email protected]>---
v2: memset instead of setting padding by hand--- fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/xfs/libxfs/xfs_attr_leaf.c +0
-0
fs/xfs/libxfs/xfs_attr_leaf.c xfs_attr_shortform_create( · line 660
Quoted 10 lines
fs/xfs/libxfs/xfs_attr_leaf.c +2
-2@@ -653,8 +653,8 @@ xfs_attr_shortform_create(ASSERT (ifp->if_flags &XFS_IFINLINE ); }xfs_idata_realloc (dp,sizeof (*hdr),XFS_ATTR_FORK ); - hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; - hdr->count =0 ; + hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; +memset (hdr,0 ,sizeof (*hdr)); hdr->totsize =cpu_to_be16 (sizeof (*hdr));xfs_trans_log_inode (args->trans, dp,XFS_ILOG_CORE |XFS_ILOG_ADATA ); }
Looks good.
Reviewed-by Dave Chinner <[email protected]>
Signature · 2 lines
Dave Chinner [email protected]