Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1774393pxb; Mon, 13 Sep 2021 05:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW2u7e9QqcOzNcx/a3IUcAZMhgm4sj6BHlwXzf3eTxs8I4zTNaSw2xLGl8T1g7ZRCc8UaM X-Received: by 2002:a17:906:1289:: with SMTP id k9mr12598629ejb.2.1631535704066; Mon, 13 Sep 2021 05:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631535704; cv=none; d=google.com; s=arc-20160816; b=XPQZyVPD5HC1HXGziz+Sc6qgdI469SeFrBO+Qq1NGKG5ob6BOYO5wC8H17NQMR8ALV 4i0ZQ8lxM0pxuBBQ9uCEixWL9b0lY30quPkoTI7G+ANUSLd26PaxopmjxL/LsnroHa8c 9z22w7W3c8fSb9RvyKHqgoBUg7PiyJ3sim2occb4z7L92NftqtmUBPAZ3O0+U0xkuOCO 6GBldnMRBkkggPqprcIPKpQhNBfuyV/vTmYMpJdB2tfN1j3ZBtUUfGHLXv3e/T68ZfNF R7kVe09+vqXV1WKOZtzDz1BbBBM0Ux+khcypK1qhcETa7sLFZZSOP8cWxLFl4DLLMz7i 89/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=X4LLFjElTCViURRsaAE2BEVdjeFzrZqm9L3/lLhM0NU=; b=X/mxQkRXvYM9do8t9lMWuh1wd9ZcMgcINVmI7pYwmYcnE22M6W2PqM+HGRUx7RAX5C EDe4Zjs5BHjVzCs65UDI902ScoKpzdpBkhPxggYTmUJ+2WU30uOIZ/5lHg9m+VbdZDMn v5Imkf7Oz4I68msQjVyOAL9agIEFhjK3oDxedvFmispFh6lkhoR8FAoemyQQLDKwrGoI QTTcAlQrGC3jjbIS/A3CW6qpu3q3Ejq/Re/ydYqfw2HFNBCVF+TpZRinpPb2BBcmBT4e 8doxkpygHN4TdwZ0UfTLGYh7KEE2jgp65G0dFjd1/ms70Prx6U05VlmkJLx1VIlhE/WI EzrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si7423642ejk.777.2021.09.13.05.21.19; Mon, 13 Sep 2021 05:21:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239904AbhIMMSB (ORCPT + 99 others); Mon, 13 Sep 2021 08:18:01 -0400 Received: from mxout70.expurgate.net ([91.198.224.70]:43251 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237090AbhIMMR5 (ORCPT ); Mon, 13 Sep 2021 08:17:57 -0400 X-Greylist: delayed 688 seconds by postgrey-1.27 at vger.kernel.org; Mon, 13 Sep 2021 08:17:56 EDT Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1mPkiG-000XrG-49; Mon, 13 Sep 2021 14:05:28 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPkiF-00026b-HE; Mon, 13 Sep 2021 14:05:27 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 329D9240042; Mon, 13 Sep 2021 14:05:27 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id B4150240041; Mon, 13 Sep 2021 14:05:26 +0200 (CEST) Received: from localhost.localdomain (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 4BFAF20110; Mon, 13 Sep 2021 14:05:26 +0200 (CEST) From: Florian Eckert To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca, Eckert.Florian@googlemail.com Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/1] tpm/tpm_i2c_infineon: Fix init endian vendor check Date: Mon, 13 Sep 2021 14:05:21 +0200 Message-ID: <20210913120521.18572-1-fe@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de Content-Transfer-Encoding: quoted-printable X-purgate: clean X-purgate-type: clean X-purgate-ID: 151534::1631534728-00009D1C-E8CFFB6C/0/0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On my embedded system I use this tpm infineon chip via i2c bus. The system is a MIPS architecture and therefore works in big endian mode. The problem is, that the chip type is not correctly recognized, because the vendor ID is wrongly aligned in the memory. By declaring the vendor ID variable as a `__le32` type, the TPM chip is then correctly recognized by the driver and feels then responsible. The device works than as expected. Signed-off-by: Florian Eckert --- v2: * use variable type instead of le32_to_cpus function call drivers/char/tpm/tpm_i2c_infineon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i= 2c_infineon.c index a19d32cb4e94..30c320ea57fd 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -611,7 +611,7 @@ static const struct tpm_class_ops tpm_tis_i2c =3D { =20 static int tpm_tis_i2c_init(struct device *dev) { - u32 vendor; + __le32 vendor; int rc =3D 0; struct tpm_chip *chip; =20 --=20 2.20.1