aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-25 08:30:24 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-25 08:30:24 -0400
commit89291a9d5b70778e49e2563247c6c7e3efac9b14 (patch)
treeb8fdf0d2e88d47dda7ba70e088dd3c8dd0c90d78 /fs
parentc5b553cc2c36f770086a37764f7a06dd615eda8f (diff)
[JFFS2] Fix 64-bit size_t problems in XATTR code.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/scan.c2
-rw-r--r--fs/jffs2/xattr.c28
2 files changed, 15 insertions, 15 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 404ba6e48581..3fb0e7e82cf2 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -379,7 +379,7 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
379 } 379 }
380 380
381 if (PAD(sizeof(struct jffs2_raw_xref)) != je32_to_cpu(rr->totlen)) { 381 if (PAD(sizeof(struct jffs2_raw_xref)) != je32_to_cpu(rr->totlen)) {
382 JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%u\n", 382 JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%zd\n",
383 ofs, je32_to_cpu(rr->totlen), 383 ofs, je32_to_cpu(rr->totlen),
384 PAD(sizeof(struct jffs2_raw_xref))); 384 PAD(sizeof(struct jffs2_raw_xref)));
385 if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(rr->totlen)))) 385 if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(rr->totlen))))
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 2255f1367bd5..2d82e250be34 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -111,7 +111,7 @@ static void delete_xattr_datum_node(struct jffs2_sb_info *c, struct jffs2_xattr_
111{ 111{
112 /* must be called under down_write(xattr_sem) */ 112 /* must be called under down_write(xattr_sem) */
113 struct jffs2_raw_xattr rx; 113 struct jffs2_raw_xattr rx;
114 uint32_t length; 114 size_t length;
115 int rc; 115 int rc;
116 116
117 if (!xd->node) { 117 if (!xd->node) {
@@ -124,14 +124,14 @@ static void delete_xattr_datum_node(struct jffs2_sb_info *c, struct jffs2_xattr_
124 sizeof(struct jffs2_unknown_node), 124 sizeof(struct jffs2_unknown_node),
125 &length, (char *)&rx); 125 &length, (char *)&rx);
126 if (rc || length != sizeof(struct jffs2_unknown_node)) { 126 if (rc || length != sizeof(struct jffs2_unknown_node)) {
127 JFFS2_ERROR("jffs2_flash_read()=%d, req=%u, read=%u at %#08x\n", 127 JFFS2_ERROR("jffs2_flash_read()=%d, req=%zu, read=%zu at %#08x\n",
128 rc, sizeof(struct jffs2_unknown_node), 128 rc, sizeof(struct jffs2_unknown_node),
129 length, ref_offset(xd->node)); 129 length, ref_offset(xd->node));
130 } 130 }
131 rc = jffs2_flash_write(c, ref_offset(xd->node), sizeof(rx), 131 rc = jffs2_flash_write(c, ref_offset(xd->node), sizeof(rx),
132 &length, (char *)&rx); 132 &length, (char *)&rx);
133 if (rc || length != sizeof(struct jffs2_raw_xattr)) { 133 if (rc || length != sizeof(struct jffs2_raw_xattr)) {
134 JFFS2_ERROR("jffs2_flash_write()=%d, req=%u, wrote=%u ar %#08x\n", 134 JFFS2_ERROR("jffs2_flash_write()=%d, req=%zu, wrote=%zu ar %#08x\n",
135 rc, sizeof(rx), length, ref_offset(xd->node)); 135 rc, sizeof(rx), length, ref_offset(xd->node));
136 } 136 }
137 } 137 }
@@ -169,7 +169,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat
169 169
170 rc = jffs2_flash_read(c, ref_offset(xd->node), sizeof(rx), &readlen, (char *)&rx); 170 rc = jffs2_flash_read(c, ref_offset(xd->node), sizeof(rx), &readlen, (char *)&rx);
171 if (rc || readlen != sizeof(rx)) { 171 if (rc || readlen != sizeof(rx)) {
172 JFFS2_WARNING("jffs2_flash_read()=%d, req=%u, read=%u at %#08x\n", 172 JFFS2_WARNING("jffs2_flash_read()=%d, req=%zu, read=%zu at %#08x\n",
173 rc, sizeof(rx), readlen, ref_offset(xd->node)); 173 rc, sizeof(rx), readlen, ref_offset(xd->node));
174 return rc ? rc : -EIO; 174 return rc ? rc : -EIO;
175 } 175 }
@@ -240,7 +240,7 @@ static int do_load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum
240 length, &readlen, data); 240 length, &readlen, data);
241 241
242 if (ret || length!=readlen) { 242 if (ret || length!=readlen) {
243 JFFS2_WARNING("jffs2_flash_read() returned %d, request=%d, readlen=%d, at %#08x\n", 243 JFFS2_WARNING("jffs2_flash_read() returned %d, request=%d, readlen=%zu, at %#08x\n",
244 ret, length, readlen, ref_offset(xd->node)); 244 ret, length, readlen, ref_offset(xd->node));
245 kfree(data); 245 kfree(data);
246 return ret ? ret : -EIO; 246 return ret ? ret : -EIO;
@@ -307,7 +307,7 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
307 struct jffs2_raw_node_ref *raw; 307 struct jffs2_raw_node_ref *raw;
308 struct jffs2_raw_xattr rx; 308 struct jffs2_raw_xattr rx;
309 struct kvec vecs[2]; 309 struct kvec vecs[2];
310 uint32_t length; 310 size_t length;
311 int rc, totlen; 311 int rc, totlen;
312 uint32_t phys_ofs = write_ofs(c); 312 uint32_t phys_ofs = write_ofs(c);
313 313
@@ -335,7 +335,7 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
335 335
336 rc = jffs2_flash_writev(c, vecs, 2, phys_ofs, &length, 0); 336 rc = jffs2_flash_writev(c, vecs, 2, phys_ofs, &length, 0);
337 if (rc || totlen != length) { 337 if (rc || totlen != length) {
338 JFFS2_WARNING("jffs2_flash_writev()=%d, req=%u, wrote=%u, at %#08x\n", 338 JFFS2_WARNING("jffs2_flash_writev()=%d, req=%u, wrote=%zu, at %#08x\n",
339 rc, totlen, length, phys_ofs); 339 rc, totlen, length, phys_ofs);
340 rc = rc ? rc : -EIO; 340 rc = rc ? rc : -EIO;
341 if (length) 341 if (length)
@@ -459,7 +459,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref
459 459
460 rc = jffs2_flash_read(c, ref_offset(ref->node), sizeof(rr), &readlen, (char *)&rr); 460 rc = jffs2_flash_read(c, ref_offset(ref->node), sizeof(rr), &readlen, (char *)&rr);
461 if (rc || sizeof(rr) != readlen) { 461 if (rc || sizeof(rr) != readlen) {
462 JFFS2_WARNING("jffs2_flash_read()=%d, req=%u, read=%u, at %#08x\n", 462 JFFS2_WARNING("jffs2_flash_read()=%d, req=%zu, read=%zu, at %#08x\n",
463 rc, sizeof(rr), readlen, ref_offset(ref->node)); 463 rc, sizeof(rr), readlen, ref_offset(ref->node));
464 return rc ? rc : -EIO; 464 return rc ? rc : -EIO;
465 } 465 }
@@ -475,7 +475,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref
475 || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF 475 || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF
476 || je32_to_cpu(rr.totlen) != PAD(sizeof(rr))) { 476 || je32_to_cpu(rr.totlen) != PAD(sizeof(rr))) {
477 JFFS2_ERROR("inconsistent xref at %#08x, magic=%#04x/%#04x, " 477 JFFS2_ERROR("inconsistent xref at %#08x, magic=%#04x/%#04x, "
478 "nodetype=%#04x/%#04x, totlen=%u/%u\n", 478 "nodetype=%#04x/%#04x, totlen=%u/%zu\n",
479 ref_offset(ref->node), je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK, 479 ref_offset(ref->node), je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK,
480 je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF, 480 je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF,
481 je32_to_cpu(rr.totlen), PAD(sizeof(rr))); 481 je32_to_cpu(rr.totlen), PAD(sizeof(rr)));
@@ -502,7 +502,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref
502static void delete_xattr_ref_node(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref) 502static void delete_xattr_ref_node(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
503{ 503{
504 struct jffs2_raw_xref rr; 504 struct jffs2_raw_xref rr;
505 uint32_t length; 505 size_t length;
506 int rc; 506 int rc;
507 507
508 if (jffs2_sum_active()) { 508 if (jffs2_sum_active()) {
@@ -511,14 +511,14 @@ static void delete_xattr_ref_node(struct jffs2_sb_info *c, struct jffs2_xattr_re
511 sizeof(struct jffs2_unknown_node), 511 sizeof(struct jffs2_unknown_node),
512 &length, (char *)&rr); 512 &length, (char *)&rr);
513 if (rc || length != sizeof(struct jffs2_unknown_node)) { 513 if (rc || length != sizeof(struct jffs2_unknown_node)) {
514 JFFS2_ERROR("jffs2_flash_read()=%d, req=%u, read=%u at %#08x\n", 514 JFFS2_ERROR("jffs2_flash_read()=%d, req=%zu, read=%zu at %#08x\n",
515 rc, sizeof(struct jffs2_unknown_node), 515 rc, sizeof(struct jffs2_unknown_node),
516 length, ref_offset(ref->node)); 516 length, ref_offset(ref->node));
517 } 517 }
518 rc = jffs2_flash_write(c, ref_offset(ref->node), sizeof(rr), 518 rc = jffs2_flash_write(c, ref_offset(ref->node), sizeof(rr),
519 &length, (char *)&rr); 519 &length, (char *)&rr);
520 if (rc || length != sizeof(struct jffs2_raw_xref)) { 520 if (rc || length != sizeof(struct jffs2_raw_xref)) {
521 JFFS2_ERROR("jffs2_flash_write()=%d, req=%u, wrote=%u at %#08x\n", 521 JFFS2_ERROR("jffs2_flash_write()=%d, req=%zu, wrote=%zu at %#08x\n",
522 rc, sizeof(rr), length, ref_offset(ref->node)); 522 rc, sizeof(rr), length, ref_offset(ref->node));
523 } 523 }
524 } 524 }
@@ -549,7 +549,7 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
549 /* must be called under down_write(xattr_sem) */ 549 /* must be called under down_write(xattr_sem) */
550 struct jffs2_raw_node_ref *raw; 550 struct jffs2_raw_node_ref *raw;
551 struct jffs2_raw_xref rr; 551 struct jffs2_raw_xref rr;
552 uint32_t length; 552 size_t length;
553 uint32_t phys_ofs = write_ofs(c); 553 uint32_t phys_ofs = write_ofs(c);
554 int ret; 554 int ret;
555 555
@@ -564,7 +564,7 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
564 564
565 ret = jffs2_flash_write(c, phys_ofs, sizeof(rr), &length, (char *)&rr); 565 ret = jffs2_flash_write(c, phys_ofs, sizeof(rr), &length, (char *)&rr);
566 if (ret || sizeof(rr) != length) { 566 if (ret || sizeof(rr) != length) {
567 JFFS2_WARNING("jffs2_flash_write() returned %d, request=%u, retlen=%u, at %#08x\n", 567 JFFS2_WARNING("jffs2_flash_write() returned %d, request=%zu, retlen=%zu, at %#08x\n",
568 ret, sizeof(rr), length, phys_ofs); 568 ret, sizeof(rr), length, phys_ofs);
569 ret = ret ? ret : -EIO; 569 ret = ret ? ret : -EIO;
570 if (length) 570 if (length)