]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ocxl: Fix endiannes bug in read_afu_name()
authorGreg Kurz <groug@kaod.org>
Tue, 11 Dec 2018 17:58:21 +0000 (18:58 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitb65c39a779820bf404f062747063e5bacc044a04
treea53b1ccc4bdba0a74e559030d458868c8b0d92ea
parent76d5a7518854fcbc190bf90b2e8636aa64205f25
ocxl: Fix endiannes bug in read_afu_name()

BugLink: https://bugs.launchpad.net/bugs/1837257
commit 2f07229f02d4c55affccd11a61af4fd4b94dc436 upstream.

The AFU Descriptor Template in the PCI config space has a Name Space
field which is a 24 Byte ASCII character string of descriptive name
space for the AFU. The OCXL driver read the string four characters at
a time with pci_read_config_dword().

This optimization is valid on a little-endian system since this is PCI,
but a big-endian system ends up with each subset of four characters in
reverse order.

This could be fixed by switching to read characters one by one. Another
option is to swap the bytes if we're big-endian.

Go for the latter with le32_to_cpu().

Cc: stable@vger.kernel.org # v4.16
Signed-off-by: Greg Kurz <groug@kaod.org>
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/misc/ocxl/config.c