Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andreas Noever and committed by
Greg Kroah-Hartman
801dba53 3543fb77

+2 -2
+2 -2
drivers/thunderbolt/ctl.c
··· 355 355 pkg->frame.sof = type; 356 356 pkg->frame.eof = type; 357 357 cpu_to_be32_array(pkg->buffer, data, len / 4); 358 - *(u32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len); 358 + *(__be32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len); 359 359 360 360 res = ring_tx(ctl->tx, &pkg->frame); 361 361 if (res) /* ring is stopped */ ··· 412 412 } 413 413 414 414 frame->size -= 4; /* remove checksum */ 415 - if (*(u32 *) (pkg->buffer + frame->size) 415 + if (*(__be32 *) (pkg->buffer + frame->size) 416 416 != tb_crc(pkg->buffer, frame->size)) { 417 417 tb_ctl_err(pkg->ctl, 418 418 "RX: checksum mismatch, dropping packet\n");