mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] ocfs2: use correct endian in ocfs2_dinode_has_extents
@ 2025-10-25 12:32 Joseph Qi
  2025-10-25 12:32 ` [PATCH 2/2] ocfs2: convert to host endian in ocfs2_validate_inode_block Joseph Qi
  2025-10-27  5:53 ` [PATCH 1/2] ocfs2: use correct endian in ocfs2_dinode_has_extents Heming Zhao
  0 siblings, 2 replies; 4+ messages in thread
From: Joseph Qi @ 2025-10-25 12:32 UTC (permalink / raw)
  To: Andrew Morton, Heming Zhao; +Cc: ocfs2-devel, linux-kernel

Fields in ocfs2_dinode is little endian, covert to host endian when
checking those contents.

Fixes: fdbb6cd96ed5 ("ocfs2: correct l_next_free_rec in online check")
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
 fs/ocfs2/inode.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index fcc89856ab95..0a0a96054bfe 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -201,13 +201,15 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
 static int ocfs2_dinode_has_extents(struct ocfs2_dinode *di)
 {
 	/* inodes flagged with other stuff in id2 */
-	if (di->i_flags & (OCFS2_SUPER_BLOCK_FL | OCFS2_LOCAL_ALLOC_FL |
-			   OCFS2_CHAIN_FL | OCFS2_DEALLOC_FL))
+	if (le32_to_cpu(di->i_flags) &
+	    (OCFS2_SUPER_BLOCK_FL | OCFS2_LOCAL_ALLOC_FL | OCFS2_CHAIN_FL |
+	     OCFS2_DEALLOC_FL))
 		return 0;
 	/* i_flags doesn't indicate when id2 is a fast symlink */
-	if (S_ISLNK(di->i_mode) && di->i_size && di->i_clusters == 0)
+	if (S_ISLNK(le16_to_cpu(di->i_mode)) && le64_to_cpu(di->i_size) &&
+	    !le32_to_cpu(di->i_clusters))
 		return 0;
-	if (di->i_dyn_features & OCFS2_INLINE_DATA_FL)
+	if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)
 		return 0;
 
 	return 1;
-- 
2.39.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-27  5:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-25 12:32 [PATCH 1/2] ocfs2: use correct endian in ocfs2_dinode_has_extents Joseph Qi
2025-10-25 12:32 ` [PATCH 2/2] ocfs2: convert to host endian in ocfs2_validate_inode_block Joseph Qi
2025-10-27  5:54   ` Heming Zhao
2025-10-27  5:53 ` [PATCH 1/2] ocfs2: use correct endian in ocfs2_dinode_has_extents Heming Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®