mtd/fs/jffs2/ecos/src fs-ecos.c,1.36,1.37

gthomas at infradead.org gthomas at infradead.org
Wed Apr 21 14:45:57 EDT 2004


Update of /home/cvs/mtd/fs/jffs2/ecos/src
In directory phoenix.infradead.org:/tmp/cvs-serv9885/src

Modified Files:
	fs-ecos.c 
Log Message:
Fix sizeof() errors - from Andrew Lunn

Index: fs-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/fs-ecos.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- fs-ecos.c	1 Apr 2004 03:39:55 -0000	1.36
+++ fs-ecos.c	21 Apr 2004 18:45:54 -0000	1.37
@@ -1268,7 +1268,7 @@
 	D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
 		  (unsigned int)inode->i_size, offset));
 
-	ret = jffs2_reserve_space(c, sizeof(ri), &phys_ofs, &alloc_len, ALLOC_NORMAL);
+	ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloc_len, ALLOC_NORMAL);
 	if (ret)
 		return ret;
 
@@ -1276,8 +1276,8 @@
 
 	ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
 	ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-	ri->totlen = cpu_to_je32(sizeof(ri));
-	ri->hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
+	ri->totlen = cpu_to_je32(sizeof(*ri));
+	ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
 
 	ri->version = cpu_to_je32(++f->highest_version);
 	ri->isize = cpu_to_je32(max((uint32_t)inode->i_size, offset));
@@ -1286,7 +1286,7 @@
 	ri->dsize = cpu_to_je32(offset - inode->i_size);
 	ri->csize = cpu_to_je32(0);
 	ri->compr = JFFS2_COMPR_ZERO;
-	ri->node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
+	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
 	ri->data_crc = cpu_to_je32(0);
 		
 	fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
@@ -1418,10 +1418,10 @@
 		return EINVAL;
 	}
 
-	// Check that pos is still within current file size, or at the
-	// very end.
-	if (pos < 0 || pos > node->i_size)
-		return EINVAL;
+        // Check that pos is still within current file size, or at the
+        // very end.
+        if (pos < 0 || pos > node->i_size)
+                return EINVAL;
 
 	// All OK, set fp offset and return new position.
 	*apos = fp->f_offset = pos;




More information about the linux-mtd-cvs mailing list