Skip to contentSkip to conversation

endian bug?

Ocfs2-devel New Mark Fasheh 2 participants 2 messages Feb 29, 2008 – Mar 2, 2008 OCFS2

lore
Share & tools
lore
#0 lore raw

Compiling with sparse today, I get:

fs/ocfs2/resize.c:600:16: warning: cast to restricted type fs/ocfs2/resize.c:600:14: warning: incorrect type in assignment (different base types)
fs/ocfs2/resize.c:600:14: expected restricted unsigned long long
[usertype] c_blkno
fs/ocfs2/resize.c:600:14: got unsigned long long [unsigned] [usertype]
<noident>

Which in my tree is:

	cr->c_blkno = le64_to_cpu(input->group);

where 'cr' is of type 'ocfs2_chain_rec'... This looks wrong to me, would you care to verify (and send a patch)?

	--Mark

--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]

#1 lore raw

PATCH 1/1 Fix an endian bug in online resize.

In ocfs2_group_add, 'cr' is of type 'ocfs2_chain_rec', so here is a endian bug. Fix it.

---
 fs/ocfs2/resize.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ocfs2/resize.c +1 -1
index 37835ff..8166968 100644
@@ -597,7 +597,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
 		memset(cr, 0, sizeof(struct ocfs2_chain_rec));
 	}
 
-	cr->c_blkno = le64_to_cpu(input->group);
+	cr->c_blkno = cpu_to_le64(input->group);
 	le32_add_cpu(&cr->c_total, input->clusters * cl_bpc);
 	le32_add_cpu(&cr->c_free, input->frees * cl_bpc);
 
Signature · 1 line
1.5.3.GIT