[SLOF] [PATCH v3 12/17] Add TPM firmware API call get-maximum-cmd-size

Stefan Berger stefanb at linux.vnet.ibm.com
Sat Mar 5 02:38:30 AEDT 2016


On 03/03/2016 11:32 PM, Hon c Lo wrote:
>
> Hi Stefan,
>
> > +uint32_t tpm_get_maximum_cmd_size(void)
> > +{
> > +   uint32_t rc;
> > +   uint32_t return_code;
> > +   struct tpm_rsp_getcap_buffersize buffersize;
> > +   uint32_t result;
> > +
> > +   if (!has_working_tpm())
> > +      return 0;
> > +
> > +   rc = build_and_send_cmd(TPM_ORD_GET_CAPABILITY,
> > +            get_capability_buffer_size,
> > +            sizeof(get_capability_buffer_size),
> > +            (uint8_t *)&buffersize, sizeof(buffersize),
> > +            &return_code, TPM_DURATION_TYPE_SHORT);
> > +
> > +   if (rc || return_code)
> > +      goto err_exit;
> > +
> > +   result = MIN(cpu_to_be32(buffersize.buffersize),
>
> Should it be using be32_to_cpu() instead? I thought we were getting 
> buffersize in network-byte-order format.
>

Good catch. Thanks.

    Stefan



More information about the SLOF mailing list