lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1403293345-20772-1-git-send-email-andreas.noever@gmail.com>
Date:	Fri, 20 Jun 2014 21:42:22 +0200
From:	Andreas Noever <andreas.noever@...il.com>
To:	linux-kernel@...r.kernel.org, Greg KH <greg@...ah.com>
Cc:	Andreas Noever <andreas.noever@...il.com>
Subject: [PATCH 1/4] 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@...el.com>
Signed-off-by: Andreas Noever <andreas.noever@...il.com>
---
 drivers/thunderbolt/ctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index 4c6da92..799634b 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");
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ