Re: [PATCH] ubifs: possible missed le64_to_cpu() in journal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Ursprüngliche Mail -----
> Von: "Ben Dooks (Codethink)" <ben.dooks@xxxxxxxxxxxxxxx>
> An: linux-kernel@xxxxxxxxxxxxxxxxxxxxx
> CC: "Ben Dooks (Codethink)" <ben.dooks@xxxxxxxxxxxxxxx>, "richard" <richard@xxxxxx>, "Artem Bityutskiy"
> <dedekind1@xxxxxxxxx>, "Adrian Hunter" <adrian.hunter@xxxxxxxxx>, "linux-mtd" <linux-mtd@xxxxxxxxxxxxxxxxxxx>,
> "linux-kernel" <linux-kernel@xxxxxxxxxxxxxxx>
> Gesendet: Mittwoch, 16. Oktober 2019 12:08:03
> Betreff: [PATCH] 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 inum
> fs/ubifs/journal.c:902:58:    got restricted __le64 [usertype] inum
> 
> Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> ---
> Cc: Richard Weinberger <richard@xxxxxx>
> Cc: Artem Bityutskiy <dedekind1@xxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: linux-mtd@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
> fs/ubifs/journal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
> index d6136f7c1cfc..388fe8f5dc51 100644
> --- a/fs/ubifs/journal.c
> +++ b/fs/ubifs/journal.c
> @@ -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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux