* [PATCH] xfs: fix pointer arithmetic error on 32-bit systems
@ 2026-06-10 4:57 Darrick J. Wong
2026-06-10 5:14 ` Christoph Hellwig
2026-06-10 15:37 ` Carlos Maiolino
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2026-06-10 4:57 UTC (permalink / raw)
To: Christoph Hellwig, Carlos Maiolino; +Cc: xfs
From: Darrick J. Wong <djwong@kernel.org>
The translation of the old XFS_BMBT_KEY_ADDR macro into a static
function is not correct on 32-bit systems because the sizeof() argument
went from being a xfs_bmbt_key_t (i.e. a struct) to a (struct
xfs_bmbt_key *) (i.e. a pointer to the same struct). On 64-bit systems
this turns out ok because they are the same size, but on 32-bit systems
this is catastrophic because they are not the same size. So far there
have been no complaints, most likely because the xfs developers urge
against running it on 32-bit systems. But this needs fixing asap.
Cc: <stable@vger.kernel.org> # v6.12
Fixes: 79124b37400635 ("xfs: replace shouty XFS_BM{BT,DR} macros")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/xfs/libxfs/xfs_bmap_btree.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.h b/fs/xfs/libxfs/xfs_bmap_btree.h
index b238d559ab0369..e0c870beaf670c 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.h
+++ b/fs/xfs/libxfs/xfs_bmap_btree.h
@@ -89,7 +89,7 @@ xfs_bmbt_key_addr(
{
return (struct xfs_bmbt_key *)
((char *)block + xfs_bmbt_block_len(mp) +
- (index - 1) * sizeof(struct xfs_bmbt_key *));
+ (index - 1) * sizeof(struct xfs_bmbt_key));
}
static inline xfs_bmbt_ptr_t *
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: fix pointer arithmetic error on 32-bit systems
2026-06-10 4:57 [PATCH] xfs: fix pointer arithmetic error on 32-bit systems Darrick J. Wong
@ 2026-06-10 5:14 ` Christoph Hellwig
2026-06-10 15:37 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-06-10 5:14 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Carlos Maiolino, xfs
On Tue, Jun 09, 2026 at 09:57:24PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> The translation of the old XFS_BMBT_KEY_ADDR macro into a static
> function is not correct on 32-bit systems because the sizeof() argument
> went from being a xfs_bmbt_key_t (i.e. a struct) to a (struct
> xfs_bmbt_key *) (i.e. a pointer to the same struct). On 64-bit systems
> this turns out ok because they are the same size, but on 32-bit systems
> this is catastrophic because they are not the same size. So far there
> have been no complaints, most likely because the xfs developers urge
> against running it on 32-bit systems. But this needs fixing asap.
Eww. I think we either need working 32-bit CI, or officially mark
32-bit as deprecated..
The fix looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix pointer arithmetic error on 32-bit systems
2026-06-10 4:57 [PATCH] xfs: fix pointer arithmetic error on 32-bit systems Darrick J. Wong
2026-06-10 5:14 ` Christoph Hellwig
@ 2026-06-10 15:37 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2026-06-10 15:37 UTC (permalink / raw)
To: Christoph Hellwig, Darrick J. Wong; +Cc: xfs
On Tue, 09 Jun 2026 21:57:24 -0700, Darrick J. Wong wrote:
> The translation of the old XFS_BMBT_KEY_ADDR macro into a static
> function is not correct on 32-bit systems because the sizeof() argument
> went from being a xfs_bmbt_key_t (i.e. a struct) to a (struct
> xfs_bmbt_key *) (i.e. a pointer to the same struct). On 64-bit systems
> this turns out ok because they are the same size, but on 32-bit systems
> this is catastrophic because they are not the same size. So far there
> have been no complaints, most likely because the xfs developers urge
> against running it on 32-bit systems. But this needs fixing asap.
>
> [...]
Applied to for-next, thanks!
[1/1] xfs: fix pointer arithmetic error on 32-bit systems
commit: 84eec3f7fc73144d1a230c9e8ad92721e37dcaab
Best regards,
--
Carlos Maiolino <cem@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-10 15:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 4:57 [PATCH] xfs: fix pointer arithmetic error on 32-bit systems Darrick J. Wong
2026-06-10 5:14 ` Christoph Hellwig
2026-06-10 15:37 ` Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox