Re: ibmvtpm byteswapping inconsistency
From: Vicky <hidden>
Date: 2017-02-02 04:41:38
Also in:
lkml
On Jan 26, 2017, at 5:58 PM, Ashley Lai [off-list ref] wrote: =20 Adding Vicky from IBM. =20 =20 On 01/26/2017 04:05 PM, Jason Gunthorpe wrote:quoted
On Thu, Jan 26, 2017 at 09:22:48PM +0100, Michal Such??nek wrote: =20quoted
This is repeated a few times in the driver so I added memset to =
quiet
quoted
quoted
gcc and make behavior deterministic in case the unused fields get =
some
quoted
quoted
meaning in the future.Yep, reserved certainly needs to be zeroed.. Can you send a patch? memset is overkill... =20quoted
However, in tpm_ibmvtpm_send the structure is initialized as =20 struct ibmvtpm_crq crq; __be64 *word =3D (__be64 *)&crq; ... crq.valid =3D (u8)IBMVTPM_VALID_CMD; crq.msg =3D (u8)VTPM_TPM_COMMAND; crq.len =3D cpu_to_be16(count); crq.data =3D cpu_to_be32(ibmvtpm->rtce_dma_handle); =20 and submitted with =20 rc =3D ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]), be64_to_cpu(word[1])); meaning it is swapped twice.No idea, Nayna may know. =20 My guess is that '__be64 *word' should be 'u64 *word'... =20 Jason=20
I don=92t think we want =91word' to be changed back to be of type =91u64=92= . Please see commit 62dfd912ab3b5405b6fe72d0135c37e9648071f1 Vicky=