From: Tejun Heo <tj@kernel.org>
To: kbuild test robot <fengguang.wu@intel.com>
Cc: Marc Carino <marc.ceeeee@gmail.com>,
kbuild-all@01.org, linux-ide@vger.kernel.org
Subject: Re: [drm-exynos:dmabuf-sync 6976/8283] drivers/ata/libata-core.c:574:19: sparse: restricted __le32 degrades to integer
Date: Sat, 31 Aug 2013 09:04:59 -0400 [thread overview]
Message-ID: <20130831130459.GA16257@mtj.dyndns.org> (raw)
In-Reply-To: <52216105.LDLPibKhwtk4ZtnD%fengguang.wu@intel.com>
Hello, Marc.
On Sat, Aug 31, 2013 at 11:20:37AM +0800, kbuild test robot wrote:
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos dmabuf-sync
> head: 22c9eba34ec4787b6a32dcf521c6e07b3abfc146
> commit: 8be5ad9acb7c11b9d717bcdbe3d6de0dab081a39 [6976/8283] libata: Populate host-to-device FIS "auxiliary" field
> reproduce: make C=1 CF=-D__CHECK_ENDIAN__
...
> > 574 fis[16] = aux & 0xff;
> 575 fis[17] = (aux >> 8) & 0xff;
> 576 fis[18] = (aux >> 16) & 0xff;
> 577 fis[19] = (aux >> 24) & 0xff;
So, this warning comes from ->aux handling in ata_tf_to_fis() and
looking at it I don't think the code is correct.
const __le32 aux = cpu_to_le32(tf->auxiliary);
...
fis[16] = aux & 0xff;
fis[17] = (aux >> 8) & 0xff;
fis[18] = (aux >> 16) & 0xff;
fis[19] = (aux >> 24) & 0xff;
If it's byte-by-byte assignments, why is it doing cpu_to_le32() too?
The above code is broken and will actually make fis[] fields to be
big-endian on big-endian machines.
Please consider the following.
u32 a = 0x01020304;
printf("%d %d %d %d\n", a & 0xff, (a >> 8) & 0xff,
(a >> 16) & 0xff, (a >> 24) & 0xff);
The output will *always* be "1 2 3 4" regardless of the endianness of
the machine.
Can you please submit a patch to fix this?
Thanks.
--
tejun
parent reply other threads:[~2013-08-31 13:05 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <52216105.LDLPibKhwtk4ZtnD%fengguang.wu@intel.com>]
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=20130831130459.GA16257@mtj.dyndns.org \
--to=tj@kernel.org \
--cc=fengguang.wu@intel.com \
--cc=kbuild-all@01.org \
--cc=linux-ide@vger.kernel.org \
--cc=marc.ceeeee@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).