Thread (23 messages) 23 messages, 9 authors, 2017-02-02

Re: ibmvtpm byteswapping inconsistency

From: Vicky <hidden>
Date: 2017-02-02 04:26:06

<html><head></head><body dir=3D"auto" style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space;"><br><blockquote type=3D"cite">On Jan 26, 2017, at =
5:58 PM, Ashley Lai &lt;ashleydlai@gmail.com&gt; wrote:<br><br>Adding =
Vicky from IBM.<br><br><br>On 01/26/2017 04:05 PM, Jason Gunthorpe =
wrote:<br><blockquote type=3D"cite">On Thu, Jan 26, 2017 at 09:22:48PM =
+0100, Michal Such??nek wrote:<br><br><blockquote type=3D"cite">This is =
repeated a few times in the driver so I added memset to quiet<br>gcc and =
make behavior deterministic in case the unused fields get =
some<br>meaning in the future.<br></blockquote>Yep, reserved certainly =
needs to be zeroed.. Can you send a patch?<br>memset is =
overkill...<br><br><blockquote type=3D"cite">However, in =
tpm_ibmvtpm_send the structure is initialized as<br><br><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>struct =
ibmvtpm_crq crq;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__be64 =
*word =3D (__be64 *)&amp;crq;<br>...<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crq.valid =3D =
(u8)IBMVTPM_VALID_CMD;<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crq.msg =3D =
(u8)VTPM_TPM_COMMAND;<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crq.len =3D =
cpu_to_be16(count);<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crq.data =3D =
cpu_to_be32(ibmvtpm-&gt;rtce_dma_handle);<br><br>and submitted =
with<br><br><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>rc =3D ibmvtpm_send_crq(ibmvtpm-&gt;vdev, =
be64_to_cpu(word[0]),<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;be64_to_cpu(word[1]));<br>meaning it is =
swapped twice.<br></blockquote>No idea, Nayna may know.<br><br>My guess =
is that '__be64 *word' should be 'u64 =
*word'...<br><br>Jason<br></blockquote><br></blockquote><br><br>Please =
refer to commit =
62dfd912ab3b5405b6fe72d0135c37e9648071f1<br><br><br>Vicky<br></body></html=
=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help