Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752906AbbHCLDN (ORCPT ); Mon, 3 Aug 2015 07:03:13 -0400 Received: from smtp-out6.electric.net ([192.162.217.187]:65343 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbbHCLDM (ORCPT ); Mon, 3 Aug 2015 07:03:12 -0400 From: David Laight To: "'Laurent Dufour'" , "linuxppc-dev@lists.ozlabs.org" CC: Greg Kroah-Hartman , Jiri Slaby , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] powerpc/hvsi: Fix endianness issues in the HVSI driver Thread-Topic: [PATCH] powerpc/hvsi: Fix endianness issues in the HVSI driver Thread-Index: AQHQy3OWhkkc2JuBs0KGkILRUzV70Z36H7pQ Date: Mon, 3 Aug 2015 11:00:18 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB71D3E@AcuExch.aculab.com> References: <1438334990-11765-1-git-send-email-ldufour@linux.vnet.ibm.com> In-Reply-To: <1438334990-11765-1-git-send-email-ldufour@linux.vnet.ibm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t73B3IsB025130 Content-Length: 1073 Lines: 28 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 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?