diff options
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/build.c | 5 | ||||
-rw-r--r-- | fs/jffs2/jffs2_fs_sb.h | 2 | ||||
-rw-r--r-- | fs/jffs2/xattr.c | 12 |
3 files changed, 9 insertions, 10 deletions
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index 85c6be2db02f..3005ec4520ad 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c | |||
@@ -336,14 +336,13 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) | |||
336 | size = sizeof(struct jffs2_eraseblock) * c->nr_blocks; | 336 | size = sizeof(struct jffs2_eraseblock) * c->nr_blocks; |
337 | #ifndef __ECOS | 337 | #ifndef __ECOS |
338 | if (jffs2_blocks_use_vmalloc(c)) | 338 | if (jffs2_blocks_use_vmalloc(c)) |
339 | c->blocks = vmalloc(size); | 339 | c->blocks = vzalloc(size); |
340 | else | 340 | else |
341 | #endif | 341 | #endif |
342 | c->blocks = kmalloc(size, GFP_KERNEL); | 342 | c->blocks = kzalloc(size, GFP_KERNEL); |
343 | if (!c->blocks) | 343 | if (!c->blocks) |
344 | return -ENOMEM; | 344 | return -ENOMEM; |
345 | 345 | ||
346 | memset(c->blocks, 0, size); | ||
347 | for (i=0; i<c->nr_blocks; i++) { | 346 | for (i=0; i<c->nr_blocks; i++) { |
348 | INIT_LIST_HEAD(&c->blocks[i].list); | 347 | INIT_LIST_HEAD(&c->blocks[i].list); |
349 | c->blocks[i].offset = i * c->sector_size; | 348 | c->blocks[i].offset = i * c->sector_size; |
diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h index f864005de64c..0bc6a6c80a56 100644 --- a/fs/jffs2/jffs2_fs_sb.h +++ b/fs/jffs2/jffs2_fs_sb.h | |||
@@ -144,4 +144,4 @@ struct jffs2_sb_info { | |||
144 | void *os_priv; | 144 | void *os_priv; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | #endif /* _JFFS2_FB_SB */ | 147 | #endif /* _JFFS2_FS_SB */ |
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 9b572ca40a49..4f9cc0482949 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
@@ -151,7 +151,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat | |||
151 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", | 151 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", |
152 | offset, je32_to_cpu(rx.hdr_crc), crc); | 152 | offset, je32_to_cpu(rx.hdr_crc), crc); |
153 | xd->flags |= JFFS2_XFLAGS_INVALID; | 153 | xd->flags |= JFFS2_XFLAGS_INVALID; |
154 | return EIO; | 154 | return -EIO; |
155 | } | 155 | } |
156 | totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len)); | 156 | totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len)); |
157 | if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK | 157 | if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK |
@@ -167,7 +167,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat | |||
167 | je32_to_cpu(rx.xid), xd->xid, | 167 | je32_to_cpu(rx.xid), xd->xid, |
168 | je32_to_cpu(rx.version), xd->version); | 168 | je32_to_cpu(rx.version), xd->version); |
169 | xd->flags |= JFFS2_XFLAGS_INVALID; | 169 | xd->flags |= JFFS2_XFLAGS_INVALID; |
170 | return EIO; | 170 | return -EIO; |
171 | } | 171 | } |
172 | xd->xprefix = rx.xprefix; | 172 | xd->xprefix = rx.xprefix; |
173 | xd->name_len = rx.name_len; | 173 | xd->name_len = rx.name_len; |
@@ -230,7 +230,7 @@ static int do_load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum | |||
230 | ref_offset(xd->node), xd->data_crc, crc); | 230 | ref_offset(xd->node), xd->data_crc, crc); |
231 | kfree(data); | 231 | kfree(data); |
232 | xd->flags |= JFFS2_XFLAGS_INVALID; | 232 | xd->flags |= JFFS2_XFLAGS_INVALID; |
233 | return EIO; | 233 | return -EIO; |
234 | } | 234 | } |
235 | 235 | ||
236 | xd->flags |= JFFS2_XFLAGS_HOT; | 236 | xd->flags |= JFFS2_XFLAGS_HOT; |
@@ -268,7 +268,7 @@ static int load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
268 | if (xd->xname) | 268 | if (xd->xname) |
269 | return 0; | 269 | return 0; |
270 | if (xd->flags & JFFS2_XFLAGS_INVALID) | 270 | if (xd->flags & JFFS2_XFLAGS_INVALID) |
271 | return EIO; | 271 | return -EIO; |
272 | if (unlikely(is_xattr_datum_unchecked(c, xd))) | 272 | if (unlikely(is_xattr_datum_unchecked(c, xd))) |
273 | rc = do_verify_xattr_datum(c, xd); | 273 | rc = do_verify_xattr_datum(c, xd); |
274 | if (!rc) | 274 | if (!rc) |
@@ -460,7 +460,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref | |||
460 | if (crc != je32_to_cpu(rr.node_crc)) { | 460 | if (crc != je32_to_cpu(rr.node_crc)) { |
461 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", | 461 | JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", |
462 | offset, je32_to_cpu(rr.node_crc), crc); | 462 | offset, je32_to_cpu(rr.node_crc), crc); |
463 | return EIO; | 463 | return -EIO; |
464 | } | 464 | } |
465 | if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK | 465 | if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK |
466 | || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF | 466 | || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF |
@@ -470,7 +470,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref | |||
470 | offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK, | 470 | offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK, |
471 | je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF, | 471 | je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF, |
472 | je32_to_cpu(rr.totlen), PAD(sizeof(rr))); | 472 | je32_to_cpu(rr.totlen), PAD(sizeof(rr))); |
473 | return EIO; | 473 | return -EIO; |
474 | } | 474 | } |
475 | ref->ino = je32_to_cpu(rr.ino); | 475 | ref->ino = je32_to_cpu(rr.ino); |
476 | ref->xid = je32_to_cpu(rr.xid); | 476 | ref->xid = je32_to_cpu(rr.xid); |