[JFFS2] Fix 64-bit size_t problems in XATTR code.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu May 25 08:59:08 EDT 2006


Commit:     89291a9d5b70778e49e2563247c6c7e3efac9b14
Parent:     c5b553cc2c36f770086a37764f7a06dd615eda8f
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Thu May 25 13:30:24 2006 +0100
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Thu May 25 13:30:24 2006 +0100

    [JFFS2] Fix 64-bit size_t problems in XATTR code.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>

 fs/jffs2/scan.c  |    2 +-
 fs/jffs2/xattr.c |   28 ++++++++++++++--------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 404ba6e..3fb0e7e 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -379,7 +379,7 @@ static int jffs2_scan_xref_node(struct j
 	}
 
 	if (PAD(sizeof(struct jffs2_raw_xref)) != je32_to_cpu(rr->totlen)) {
-		JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%u\n",
+		JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%zd\n",
 			      ofs, je32_to_cpu(rr->totlen),
 			      PAD(sizeof(struct jffs2_raw_xref)));
 		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 2255f13..2d82e25 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -111,7 +111,7 @@ static void delete_xattr_datum_node(stru
 {
 	/* must be called under down_write(xattr_sem) */
 	struct jffs2_raw_xattr rx;
-	uint32_t length;
+	size_t length;
 	int rc;
 
 	if (!xd->node) {
@@ -124,14 +124,14 @@ static void delete_xattr_datum_node(stru
 				      sizeof(struct jffs2_unknown_node),
 				      &length, (char *)&rx);
 		if (rc || length != sizeof(struct jffs2_unknown_node)) {
-			JFFS2_ERROR("jffs2_flash_read()=%d, req=%u, read=%u at %#08x\n",
+			JFFS2_ERROR("jffs2_flash_read()=%d, req=%zu, read=%zu at %#08x\n",
 				    rc, sizeof(struct jffs2_unknown_node),
 				    length, ref_offset(xd->node));
 		}
 		rc = jffs2_flash_write(c, ref_offset(xd->node), sizeof(rx),
 				       &length, (char *)&rx);
 		if (rc || length != sizeof(struct jffs2_raw_xattr)) {
-			JFFS2_ERROR("jffs2_flash_write()=%d, req=%u, wrote=%u ar %#08x\n",
+			JFFS2_ERROR("jffs2_flash_write()=%d, req=%zu, wrote=%zu ar %#08x\n",
 				    rc, sizeof(rx), length, ref_offset(xd->node));
 		}
 	}
@@ -169,7 +169,7 @@ static int do_verify_xattr_datum(struct 
 
 	rc = jffs2_flash_read(c, ref_offset(xd->node), sizeof(rx), &readlen, (char *)&rx);
 	if (rc || readlen != sizeof(rx)) {
-		JFFS2_WARNING("jffs2_flash_read()=%d, req=%u, read=%u at %#08x\n",
+		JFFS2_WARNING("jffs2_flash_read()=%d, req=%zu, read=%zu at %#08x\n",
 			      rc, sizeof(rx), readlen, ref_offset(xd->node));
 		return rc ? rc : -EIO;
 	}
@@ -240,7 +240,7 @@ static int do_load_xattr_datum(struct jf
 			       length, &readlen, data);
 
 	if (ret || length!=readlen) {
-		JFFS2_WARNING("jffs2_flash_read() returned %d, request=%d, readlen=%d, at %#08x\n",
+		JFFS2_WARNING("jffs2_flash_read() returned %d, request=%d, readlen=%zu, at %#08x\n",
 			      ret, length, readlen, ref_offset(xd->node));
 		kfree(data);
 		return ret ? ret : -EIO;
@@ -307,7 +307,7 @@ static int save_xattr_datum(struct jffs2
 	struct jffs2_raw_node_ref *raw;
 	struct jffs2_raw_xattr rx;
 	struct kvec vecs[2];
-	uint32_t length;
+	size_t length;
 	int rc, totlen;
 	uint32_t phys_ofs = write_ofs(c);
 
@@ -335,7 +335,7 @@ static int save_xattr_datum(struct jffs2
 
 	rc = jffs2_flash_writev(c, vecs, 2, phys_ofs, &length, 0);
 	if (rc || totlen != length) {
-		JFFS2_WARNING("jffs2_flash_writev()=%d, req=%u, wrote=%u, at %#08x\n",
+		JFFS2_WARNING("jffs2_flash_writev()=%d, req=%u, wrote=%zu, at %#08x\n",
 			      rc, totlen, length, phys_ofs);
 		rc = rc ? rc : -EIO;
 		if (length)
@@ -459,7 +459,7 @@ static int verify_xattr_ref(struct jffs2
 
 	rc = jffs2_flash_read(c, ref_offset(ref->node), sizeof(rr), &readlen, (char *)&rr);
 	if (rc || sizeof(rr) != readlen) {
-		JFFS2_WARNING("jffs2_flash_read()=%d, req=%u, read=%u, at %#08x\n",
+		JFFS2_WARNING("jffs2_flash_read()=%d, req=%zu, read=%zu, at %#08x\n",
 			      rc, sizeof(rr), readlen, ref_offset(ref->node));
 		return rc ? rc : -EIO;
 	}
@@ -475,7 +475,7 @@ static int verify_xattr_ref(struct jffs2
 	    || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF
 	    || je32_to_cpu(rr.totlen) != PAD(sizeof(rr))) {
 		JFFS2_ERROR("inconsistent xref at %#08x, magic=%#04x/%#04x, "
-			    "nodetype=%#04x/%#04x, totlen=%u/%u\n",
+			    "nodetype=%#04x/%#04x, totlen=%u/%zu\n",
 			    ref_offset(ref->node), je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK,
 			    je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF,
 			    je32_to_cpu(rr.totlen), PAD(sizeof(rr)));
@@ -502,7 +502,7 @@ static int verify_xattr_ref(struct jffs2
 static void delete_xattr_ref_node(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
 {
 	struct jffs2_raw_xref rr;
-	uint32_t length;
+	size_t length;
 	int rc;
 
 	if (jffs2_sum_active()) {
@@ -511,14 +511,14 @@ static void delete_xattr_ref_node(struct
 				      sizeof(struct jffs2_unknown_node),
 				      &length, (char *)&rr);
 		if (rc || length != sizeof(struct jffs2_unknown_node)) {
-			JFFS2_ERROR("jffs2_flash_read()=%d, req=%u, read=%u at %#08x\n",
+			JFFS2_ERROR("jffs2_flash_read()=%d, req=%zu, read=%zu at %#08x\n",
 				    rc, sizeof(struct jffs2_unknown_node),
 				    length, ref_offset(ref->node));
 		}
 		rc = jffs2_flash_write(c, ref_offset(ref->node), sizeof(rr),
 				       &length, (char *)&rr);
 		if (rc || length != sizeof(struct jffs2_raw_xref)) {
-			JFFS2_ERROR("jffs2_flash_write()=%d, req=%u, wrote=%u at %#08x\n",
+			JFFS2_ERROR("jffs2_flash_write()=%d, req=%zu, wrote=%zu at %#08x\n",
 				    rc, sizeof(rr), length, ref_offset(ref->node));
 		}
 	}
@@ -549,7 +549,7 @@ static int save_xattr_ref(struct jffs2_s
 	/* must be called under down_write(xattr_sem) */
 	struct jffs2_raw_node_ref *raw;
 	struct jffs2_raw_xref rr;
-	uint32_t length;
+	size_t length;
 	uint32_t phys_ofs = write_ofs(c);
 	int ret;
 
@@ -564,7 +564,7 @@ static int save_xattr_ref(struct jffs2_s
 
 	ret = jffs2_flash_write(c, phys_ofs, sizeof(rr), &length, (char *)&rr);
 	if (ret || sizeof(rr) != length) {
-		JFFS2_WARNING("jffs2_flash_write() returned %d, request=%u, retlen=%u, at %#08x\n",
+		JFFS2_WARNING("jffs2_flash_write() returned %d, request=%zu, retlen=%zu, at %#08x\n",
 			      ret, sizeof(rr), length, phys_ofs);
 		ret = ret ? ret : -EIO;
 		if (length)



More information about the linux-mtd-cvs mailing list