ubifs: possible missed le64_to_cpu() in journal
Subsystems (2)
PATCH 1/1 ubifs: possible missed le64_to_cpu() in journal
In the ubifs_jnl_write_inode() functon, it calls ubifs_iget() with xent->inum. The xent->inum is __le64, but the ubifs_iget() takes native cpu endian.
I think that this should be changed to passing le64_to_cpu(xent->inum) to fix the following sparse warning:
fs/ubifs/journal.c:902:58: warning: incorrect type in argument 2 (different base types)fs/ubifs/journal.c:902:58: expected unsigned long inumfs/ubifs/journal.c:902:58: got restricted __le64 [usertype] inum
---
Cc: Richard Weinberger <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- fs/ubifs/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ubifs/journal.c +1 -1
@@ -899,7 +899,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)fname_name (&nm) = xent->name;fname_len (&nm) =le16_to_cpu (xent->nlen); - xino =ubifs_iget (c->vfs_sb, xent->inum); + xino =ubifs_iget (c->vfs_sb,le64_to_cpu (xent->inum));if (IS_ERR (xino)) { err =PTR_ERR (xino); ubifs_err(c, "dead directory entry '%s', error %d",
Signature · 1 line
2.23.0
Richard Weinberger
maintainer----- Ursprüngliche Mail -----
Quoted 36 lines
Von: "Ben Dooks (Codethink)" <[email protected]>
An: [email protected]
CC: "Ben Dooks (Codethink)" <[email protected]>, "richard" <[email protected]>, "Artem Bityutskiy" <[email protected]>, "Adrian Hunter" <[email protected]>, "linux-mtd" <[email protected]>, "linux-kernel" <[email protected]>
Gesendet: Mittwoch, 16. Oktober 2019 12:08:03
Betreff: [PATCH] ubifs: possible missedle64_to_cpu()in journalIn the
ubifs_jnl_write_inode()functon, it callsubifs_iget()withxent->inum. Thexent->inumis__le64, but theubifs_iget()takes native cpu endian.I think that this should be changed to passing
le64_to_cpu(xent->inum)to fix the following sparse warning:
fs/ubifs/journal.c:902:58: warning: incorrect type in argument 2 (different base types)fs/ubifs/journal.c:902:58: expected unsigned long inumfs/ubifs/journal.c:902:58: got restricted__le64[usertype] inumSigned-off-by Ben Dooks <[email protected]>---
Cc: Richard Weinberger <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: [email protected]
Cc: [email protected]
---fs/ubifs/journal.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)fs/ubifs/journal.c +0
-0
fs/ubifs/journal.c int ubifs_jnl_write_inode(struct ubifs_info *c, const struct · line 903
Quoted 6 lines
fs/ubifs/journal.c +1
-1@@ -899,7 +899,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode) fname_name(&nm) = xent->name;fname_len (&nm) =le16_to_cpu (xent->nlen); - xino =ubifs_iget (c->vfs_sb, xent->inum); + xino =ubifs_iget (c->vfs_sb,le64_to_cpu (xent->inum));
Good catch!
Thanks,
//richard