diff options
author | Andreas Noever <andreas.noever@gmail.com> | 2014-06-20 21:42:22 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-20 13:06:01 -0700 |
commit | 801dba53fef8bfc2f1424c33914a41810594bde2 (patch) | |
tree | fb8e32b297378ac864844eebcea1cbb9f5325ed6 /drivers | |
parent | 3543fb776d8e63934615bf7070ee5fa5a6a7382d (diff) | |
download | linux-801dba53fef8bfc2f1424c33914a41810594bde2.tar.bz2 |
thunderbolt: Add casts to prevent endianness warnings
Thunderbolt packets are big endian. Cast pkg->buffer to __be32* when
accessing the checksum.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/thunderbolt/ctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 4c6da92edcb4..799634b382c6 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c @@ -355,7 +355,7 @@ static int tb_ctl_tx(struct tb_ctl *ctl, void *data, size_t len, pkg->frame.sof = type; pkg->frame.eof = type; cpu_to_be32_array(pkg->buffer, data, len / 4); - *(u32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len); + *(__be32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len); res = ring_tx(ctl->tx, &pkg->frame); if (res) /* ring is stopped */ @@ -412,7 +412,7 @@ static void tb_ctl_rx_callback(struct tb_ring *ring, struct ring_frame *frame, } frame->size -= 4; /* remove checksum */ - if (*(u32 *) (pkg->buffer + frame->size) + if (*(__be32 *) (pkg->buffer + frame->size) != tb_crc(pkg->buffer, frame->size)) { tb_ctl_err(pkg->ctl, "RX: checksum mismatch, dropping packet\n"); |