From: Bharath Vedartham <linux.bhar@gmail.com>
To: akpm@linux-foundation.org, viro@zeniv.linux.org.uk
Cc: linux-kernel@vger.kernel.org, reiserfs-devel@vger.kernel.org
Subject: Re: [PATCH] reiserfs: Add comment to explain endianness issue in xattr_hash
Date: Tue, 23 Apr 2019 21:50:45 +0530 [thread overview]
Message-ID: <20190423162045.GA15509@bharath12345-Inspiron-5559> (raw)
In-Reply-To: <20190423161831.GA15387@bharath12345-Inspiron-5559>
On Tue, Apr 23, 2019 at 09:48:31PM +0530, Bharath Vedartham wrote:
> csum_partial() gives different results for little-endian and big-endian
> hosts. This causes images created on little-endian hosts and mounted on
> big endian hosts to see csum mismatches. This causes an endianness bug.
> Sparse gives a warning as csum_partial returns a restricted integer type
> __wsum_t and xattr_hash expects __u32. This warning acts as a reminder
> for this bug and should not be suppressed.
>
> This comment aims to convey these endianness issues.
>
> Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
> ---
> fs/reiserfs/xattr.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
> index 32d8986..0ea6654 100644
> --- a/fs/reiserfs/xattr.c
> +++ b/fs/reiserfs/xattr.c
> @@ -450,6 +450,16 @@ static struct page *reiserfs_get_page(struct inode *dir, size_t n)
>
> static inline __u32 xattr_hash(const char *msg, int len)
> {
> + /*
> + * csum_partial() gives different results for little-endian and
> + * big endian hosts. Images created on little-endian hosts and
> + * mounted on big-endian hosts(and vice versa) will see csum mismatches
> + * when trying to fetch xattrs. Treating the hash as __wsum_t would
> + * lower the frequency of mismatch. This is an endianness bug in reiserfs.
> + * The return statement would result in a sparse warning. Do not fix the sparse
> + * warning so as to not hide the reminder of the bug.
> + */
> +
> return csum_partial(msg, len, 0);
> }
>
> --
> 2.7.4
>
Is this good or is it lacking any explanation?
prev parent reply other threads:[~2019-04-23 16:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 16:18 [PATCH] reiserfs: Add comment to explain endianness issue in xattr_hash Bharath Vedartham
2019-04-23 16:20 ` Bharath Vedartham [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=20190423162045.GA15509@bharath12345-Inspiron-5559 \
--to=linux.bhar@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).