[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB71D3E@AcuExch.aculab.com>
Date: Mon, 3 Aug 2015 11:00:18 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Laurent Dufour' <ldufour@...ux.vnet.ibm.com>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] powerpc/hvsi: Fix endianness issues in the HVSI driver
From: Laurent Dufour
> Sent: 31 July 2015 10:30
> This patch fixes several endianness issues detected when running the HVSI
> driver in little endian mode.
>
> These issues are raised in little endian mode because the data exchanged in
> memory between the kernel and the hypervisor has to be in big endian
> format.
...
> diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
> index 41901997c0d6..a75146f600cb 100644
> --- a/drivers/tty/hvc/hvsi.c
> +++ b/drivers/tty/hvc/hvsi.c
> @@ -240,9 +240,9 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet,
> {
> struct hvsi_control *header = (struct hvsi_control *)packet;
>
> - switch (header->verb) {
> + switch (be16_to_cpu(header->verb)) {
> case VSV_MODEM_CTL_UPDATE:
> - if ((header->word & HVSI_TSCD) == 0) {
> + if ((be32_to_cpu(header->word) & HVSI_TSCD) == 0) {
It is generally best to byteswap constants.
David
Powered by blists - more mailing lists