Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3502041imu; Mon, 7 Jan 2019 04:40:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KC7LCmg4SmfVf26u8g+qxzS0FzzCFMFGDClRR52qmUDsFpyZRkNzyvXKSTqhs+1/wTx4Z X-Received: by 2002:a65:6417:: with SMTP id a23mr58028518pgv.236.1546864834918; Mon, 07 Jan 2019 04:40:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546864834; cv=none; d=google.com; s=arc-20160816; b=fD3Ti8ZzHpeqiibAhCAwtpInz+FHrJpcSEnoiyi/VxaK1dxp5WsggUFpEHsrdxLT2a Bc4g6Tvm/SKgLOpILvG9u9+PLxdIGeSVQbhHWc8w2SIbIXj1eeYGAUtew0gCIa47qRqW 923H+6celsZW2bWlhY+pbiBLuLgTTHGOmfo1loTp82dZ3TZvttKatBTIiaUosahjQBZw 7MQofpTcSSlU3xdYNk34m+Kejcxx+ULfoIKKb0FWe+EkwFL9TYEIaGgxAzPC1Untba6K Vl1X9fScsSJ3ISYG+f369LPFd3SCBHpgBfgrT3ZCmtQsL8RruWe8Kyuusk4AWLi3HsR5 xBfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gey8jzLo++ncUXmsQ8brq8shVT1eFidWpSFgo3WQG0k=; b=lrwP4AUVjNstJyqXx8GiUF0afUVVdib/FRUVb5wRxKhew8KntafzMk36EI2lUIPr7J 7QB8SvhISjqLheVZMUcMWLn0ggVCu9TyTl1pTCpAI5bKMh01JOMSLD/d99R5Cerap6RU RqIbjFW+io4bKyO7sXlwjCZhdMI/vwb/ftLVfoM/UNyqxO2MwzvjE/xpKVdoKhm636Wr TQUZG0hbGXzNiCjB5uS2AjFAFubFX5G6DeLBGwlajLrV+02cyCA0a2AGNquJBvaZ3OB+ /tF9W7xA2ruoJum68WWye97ph5qBipIsMvyLSXrRabja8P1c6ZX6p8Sb4qMPkTXnvDPK j3jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZR4CeeAj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si8586029pgv.456.2019.01.07.04.40.19; Mon, 07 Jan 2019 04:40:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZR4CeeAj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727943AbfAGMid (ORCPT + 99 others); Mon, 7 Jan 2019 07:38:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:53632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727460AbfAGMib (ORCPT ); Mon, 7 Jan 2019 07:38:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A8FC320859; Mon, 7 Jan 2019 12:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546864710; bh=A+6gH5gzc9Jw/TP++eq0LZgGr2I642YoFwoaZGJAiiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZR4CeeAjLXgpI4yfnIX/7Bl6uvulOwDoAW3NviTjo8+ewyCt/mNYYNGPpWaDzd1NH RlWI6jUaMo6X2Irg1iVFKYkf4Uq+sOGMpYg+dmjJCZQMI5heo9j9km+/AJCWOCjNyI Iv2ai6QfN5O5yPyPfih/S+gjoabE79piQZJ05keM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Kurz , Frederic Barrat , Andrew Donnellan , Michael Ellerman Subject: [PATCH 4.20 071/145] ocxl: Fix endiannes bug in read_afu_name() Date: Mon, 7 Jan 2019 13:31:48 +0100 Message-Id: <20190107104446.543638829@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104437.308206189@linuxfoundation.org> References: <20190107104437.308206189@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kurz 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 Acked-by: Frederic Barrat Acked-by: Andrew Donnellan Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ocxl/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -318,7 +318,7 @@ static int read_afu_name(struct pci_dev if (rc) return rc; ptr = (u32 *) &afu->name[i]; - *ptr = val; + *ptr = le32_to_cpu((__force __le32) val); } afu->name[OCXL_AFU_NAME_SZ - 1] = '\0'; /* play safe */ return 0;