xfs: various bug fixes for 6.12 [7/8]

Various bug fixes for 6.12.
 
 With a bit of luck, this should all go splendidly.
 
 Signed-off-by: Darrick J. Wong <djwong@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ2qTKExjcn+O1o2YRKO3ySh0YRpgUCZtX/ZAAKCRBKO3ySh0YR
 pqwLAQDCuI0wSdV4NQPlaIyQ9qKmxFa+7fDkouSE2ydRI2AchwEAj5yh64/w6N3g
 CGZXYvpypKBULD7/ddzaPFQEHGb8/wo=
 =S9Cu
 -----END PGP SIGNATURE-----

Merge tag 'xfs-fixes-6.12_2024-09-02' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.12-mergeA

xfs: various bug fixes for 6.12 [7/8]

Various bug fixes for 6.12.

With a bit of luck, this should all go splendidly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>

* tag 'xfs-fixes-6.12_2024-09-02' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: fix a sloppy memory handling bug in xfs_iroot_realloc
  xfs: fix FITRIM reporting again
  xfs: fix C++ compilation errors in xfs_fs.h
This commit is contained in:
Chandan Babu R 2024-09-03 09:15:32 +05:30
commit 5384639bf7
3 changed files with 9 additions and 8 deletions

View File

@ -8,6 +8,7 @@
/*
* SGI's XFS filesystem's major stuff (constants, structures)
* NOTE: This file must be compile-able with C++ compilers.
*/
/*
@ -930,13 +931,13 @@ static inline struct xfs_getparents_rec *
xfs_getparents_next_rec(struct xfs_getparents *gp,
struct xfs_getparents_rec *gpr)
{
void *next = ((void *)gpr + gpr->gpr_reclen);
void *next = ((char *)gpr + gpr->gpr_reclen);
void *end = (void *)(uintptr_t)(gp->gp_buffer + gp->gp_bufsize);
if (next >= end)
return NULL;
return next;
return (struct xfs_getparents_rec *)next;
}
/* Iterate through this file handle's directory parent pointers. */

View File

@ -463,15 +463,15 @@ xfs_iroot_realloc(
}
/*
* Only copy the records and pointers if there are any.
* Only copy the keys and pointers if there are any.
*/
if (new_max > 0) {
/*
* First copy the records.
* First copy the keys.
*/
op = (char *)XFS_BMBT_REC_ADDR(mp, ifp->if_broot, 1);
np = (char *)XFS_BMBT_REC_ADDR(mp, new_broot, 1);
memcpy(np, op, new_max * (uint)sizeof(xfs_bmbt_rec_t));
op = (char *)XFS_BMBT_KEY_ADDR(mp, ifp->if_broot, 1);
np = (char *)XFS_BMBT_KEY_ADDR(mp, new_broot, 1);
memcpy(np, op, new_max * (uint)sizeof(xfs_bmbt_key_t));
/*
* Then copy the pointers.

View File

@ -707,7 +707,7 @@ xfs_ioc_trim(
return last_error;
range.len = min_t(unsigned long long, range.len,
XFS_FSB_TO_B(mp, max_blocks));
XFS_FSB_TO_B(mp, max_blocks) - range.start);
if (copy_to_user(urange, &range, sizeof(range)))
return -EFAULT;
return 0;