[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190418155019.ab5189e4e317df2b36861012@linux-foundation.org>
Date: Thu, 18 Apr 2019 15:50:19 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Bharath Vedartham <linux.bhar@...il.com>
Cc: jannh@...gle.com, reiserfs-devel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] reiserfs: Force type conversion in xattr_hash
On Wed, 17 Apr 2019 17:22:00 +0530 Bharath Vedartham <linux.bhar@...il.com> wrote:
> This patch fixes the sparse warning:
>
> fs/reiserfs//xattr.c:453:28: warning: incorrect type in return
> expression (different base types)
> fs/reiserfs//xattr.c:453:28: expected unsigned int
> fs/reiserfs//xattr.c:453:28: got restricted __wsum
> fs/reiserfs//xattr.c:453:28: warning: incorrect type in return
> expression (different base types)
> fs/reiserfs//xattr.c:453:28: expected unsigned int
> fs/reiserfs//xattr.c:453:28: got restricted __wsum
>
> csum_partial returns restricted integer __wsum whereas xattr_hash
> expects a return type of __u32.
>
> ...
>
> --- a/fs/reiserfs/xattr.c
> +++ b/fs/reiserfs/xattr.c
> @@ -450,7 +450,7 @@ static struct page *reiserfs_get_page(struct inode *dir, size_t n)
>
> static inline __u32 xattr_hash(const char *msg, int len)
> {
> - return csum_partial(msg, len, 0);
> + return (__force __u32)csum_partial(msg, len, 0);
> }
>
> int reiserfs_commit_write(struct file *f, struct page *page,
hm. Conversion from int to __u32 should be OK - why is sparse being so
picky here?
Why is the __force needed, btw?
Powered by blists - more mailing lists