]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
nilfs2: add missing endian conversion on super block magic number
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Sat, 1 May 2010 01:07:07 +0000 (10:07 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Mon, 10 May 2010 02:32:32 +0000 (11:32 +0900)
This adds missing endian conversions in comparision of the magic
number of super blocks.  It was coincidence that prior versions didn't
incur problems; the upper byte of the magic number happened to be
equal to the lower byte.  But, semantically it's wrong to depend on
this.

This won't change anything else nor suffer any compatibility issues.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
fs/nilfs2/super.c

index a512c3b2cb77bbce2be90b8d9038d22f23d647ed..430a508b212f5f1baec50dadb1f1c5621bef124f 100644 (file)
@@ -242,8 +242,8 @@ int nilfs_commit_super(struct nilfs_sb_info *sbi, int dupsb)
        int err;
 
        /* nilfs->sem must be locked by the caller. */
-       if (sbp[0]->s_magic != NILFS_SUPER_MAGIC) {
-               if (sbp[1] && sbp[1]->s_magic == NILFS_SUPER_MAGIC)
+       if (sbp[0]->s_magic != cpu_to_le16(NILFS_SUPER_MAGIC)) {
+               if (sbp[1] && sbp[1]->s_magic == cpu_to_le16(NILFS_SUPER_MAGIC))
                        nilfs_swap_super_block(nilfs);
                else {
                        printk(KERN_CRIT "NILFS: superblock broke on dev %s\n",