From: Chao Yu <yuchao0@huawei.com>
To: Bharath Vedartham <linux.bhar@gmail.com>, jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: Force type conversion from __le32 to u32
Date: Sat, 20 Apr 2019 11:05:05 +0800 [thread overview]
Message-ID: <00548c37-765a-a2df-9ddf-d53c6ae6bae7@huawei.com> (raw)
In-Reply-To: <20190418073510.GA11396@bharath12345-Inspiron-5559>
On 2019/4/18 15:35, Bharath Vedartham wrote:
> This patch forces type conversion from __le32 to u32 to prevent sparse
> warnings like:
> warning: restricted __le32 degrades to integer
>
> dir.c:
> fscrypt_fname_disk_to_usr takes a hash of type u32 as it's second arg
> but de->hash_code is of type __le32.
>
> node.c
> NULL_ADDR is of type u32 but block_addr is of type __le32.
>
> Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
> ---
> fs/f2fs/dir.c | 2 +-
> fs/f2fs/node.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
> index 59bc460..4f39872 100644
> --- a/fs/f2fs/dir.c
> +++ b/fs/f2fs/dir.c
> @@ -828,7 +828,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d,
> int save_len = fstr->len;
>
> err = fscrypt_fname_disk_to_usr(d->inode,
> - (u32)de->hash_code, 0,
le32_to_cpu(de->hash_code)
> + (__force u32)de->hash_code, 0,
> &de_name, fstr);
> if (err)
> goto out;
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 3f99ab2..9e333a5 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -2706,7 +2706,7 @@ static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
> i = 1;
> }
> for (; i < NAT_ENTRY_PER_BLOCK; i++) {
> - if (nat_blk->entries[i].block_addr != NULL_ADDR)
> + if ((__force u32)nat_blk->entries[i].block_addr != NULL_ADDR)
block_t blkaddr = le32_to_cpu(nat_blk->entries[i].block_addr);
if (blkaddr != NULL_ADDR)
Thanks,
> valid++;
> }
> if (valid == 0) {
>
prev parent reply other threads:[~2019-04-20 3:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 7:35 [PATCH] f2fs: Force type conversion from __le32 to u32 Bharath Vedartham
2019-04-20 3:05 ` Chao Yu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00548c37-765a-a2df-9ddf-d53c6ae6bae7@huawei.com \
--to=yuchao0@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.bhar@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).