mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
3543fb776d
commit
801dba53fe
1 changed files with 2 additions and 2 deletions
|
@ -355,7 +355,7 @@ static int tb_ctl_tx(struct tb_ctl *ctl, void *data, size_t len,
|
||||||
pkg->frame.sof = type;
|
pkg->frame.sof = type;
|
||||||
pkg->frame.eof = type;
|
pkg->frame.eof = type;
|
||||||
cpu_to_be32_array(pkg->buffer, data, len / 4);
|
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);
|
res = ring_tx(ctl->tx, &pkg->frame);
|
||||||
if (res) /* ring is stopped */
|
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 */
|
frame->size -= 4; /* remove checksum */
|
||||||
if (*(u32 *) (pkg->buffer + frame->size)
|
if (*(__be32 *) (pkg->buffer + frame->size)
|
||||||
!= tb_crc(pkg->buffer, frame->size)) {
|
!= tb_crc(pkg->buffer, frame->size)) {
|
||||||
tb_ctl_err(pkg->ctl,
|
tb_ctl_err(pkg->ctl,
|
||||||
"RX: checksum mismatch, dropping packet\n");
|
"RX: checksum mismatch, dropping packet\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue