xfs: introduce v5 inode group structure
Hello Darrick J. Wong,
The patch 5f19c7fc6873: "xfs: introduce v5 inode group structure" from Jul 3, 2019, leads to the following static checker warning:
fs/xfs/xfs_ioctl.c:738 xfs_fsinumbers_fmt() warn: check that 'ig1' doesn't leak information (struct has a hole after 'xi_alloccount')
fs/xfs/xfs_ioctl.c
730 int
731 xfs_fsinumbers_fmt(
732 struct xfs_ibulk *breq, 733 const struct xfs_inumbers *igrp)
734 {
735 struct xfs_inogrp ig1;
736
737 xfs_inumbers_to_inogrp(&ig1, igrp);
The xfs_inumbers_to_inogrp() call doesn't clear the struct hole.
738 if (copy_to_user(breq->ubuffer, &ig1, sizeof(struct xfs_inogrp))) 739 return -EFAULT; 740 return xfs_ibulk_advance(breq, sizeof(struct xfs_inogrp)); 741 }
regards,
dan carpenter
Quoted 8 lines · Dan Carpenter
Hello Darrick J. Wong,
The patch
5f19c7fc6873: "xfs: introduce v5 inode group structure" from Jul 3, 2019, leads to the following static checker warning:fs/xfs/xfs_ioctl.c:738 xfs_fsinumbers_fmt() warn: check that 'ig1' doesn't leak information (struct has a hole after 'xi_alloccount')
Quoted 7 lines
fs/xfs/xfs_ioctl.c
730 int
731 xfs_fsinumbers_fmt(732 struct xfs_ibulk *breq, 733 const struct xfs_inumbers *igrp) 734 { 735 struct xfs_inogrp ig1;
Heh, yeah, that looks like a bug. Expect a patch soon, thanks for finding this. :/
--D
Quoted 12 lines
736 737 xfs_inumbers_to_inogrp(&ig1, igrp);The
xfs_inumbers_to_inogrp()call doesn't clear the struct hole.738 if (copy_to_user(breq->ubuffer, &ig1, sizeof(struct xfs_inogrp))) 739 return -EFAULT; 740 return xfs_ibulk_advance(breq, sizeof(struct xfs_inogrp)); 741 }regards,
dan carpenter