Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jffs2: fix error value sign

do_verify_xattr_datum(), do_load_xattr_datum(), load_xattr_datum()
and verify_xattr_ref() should return negative value on error.
Sometimes they return EIO that is positive. Change this to -EIO.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Vasiliy Kulikov and committed by
David Woodhouse
f326966b 23079f94

+6 -6
+6 -6
fs/jffs2/xattr.c
··· 151 151 JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", 152 152 offset, je32_to_cpu(rx.hdr_crc), crc); 153 153 xd->flags |= JFFS2_XFLAGS_INVALID; 154 - return EIO; 154 + return -EIO; 155 155 } 156 156 totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len)); 157 157 if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK ··· 167 167 je32_to_cpu(rx.xid), xd->xid, 168 168 je32_to_cpu(rx.version), xd->version); 169 169 xd->flags |= JFFS2_XFLAGS_INVALID; 170 - return EIO; 170 + return -EIO; 171 171 } 172 172 xd->xprefix = rx.xprefix; 173 173 xd->name_len = rx.name_len; ··· 230 230 ref_offset(xd->node), xd->data_crc, crc); 231 231 kfree(data); 232 232 xd->flags |= JFFS2_XFLAGS_INVALID; 233 - return EIO; 233 + return -EIO; 234 234 } 235 235 236 236 xd->flags |= JFFS2_XFLAGS_HOT; ··· 268 268 if (xd->xname) 269 269 return 0; 270 270 if (xd->flags & JFFS2_XFLAGS_INVALID) 271 - return EIO; 271 + return -EIO; 272 272 if (unlikely(is_xattr_datum_unchecked(c, xd))) 273 273 rc = do_verify_xattr_datum(c, xd); 274 274 if (!rc) ··· 460 460 if (crc != je32_to_cpu(rr.node_crc)) { 461 461 JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n", 462 462 offset, je32_to_cpu(rr.node_crc), crc); 463 - return EIO; 463 + return -EIO; 464 464 } 465 465 if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK 466 466 || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF ··· 470 470 offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK, 471 471 je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF, 472 472 je32_to_cpu(rr.totlen), PAD(sizeof(rr))); 473 - return EIO; 473 + return -EIO; 474 474 } 475 475 ref->ino = je32_to_cpu(rr.ino); 476 476 ref->xid = je32_to_cpu(rr.xid);