Re: [PATCH v4 04/13] tpm: add buffer handling for TPM2B types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue May 2, 2023 at 6:43 PM EEST, Stefan Berger wrote:
> > +void tpm_buf_append_2b(struct tpm_buf *buf, struct tpm_buf *tpm2b)
> > +{
> > +	u16 len = tpm_buf_length(tpm2b);
> > +
>
> if (tpm2b->flags & TPM_BUF_OVERFLOW) {
>      buf->flags |= TPM_BUF_OVERFLOW;
>      return;
> }
>
> > +	tpm_buf_append_u16(buf, len);
> > +	tpm_buf_append(buf, tpm_buf_data(tpm2b), len);
>
>
> > +	/* clear the buf for reuse */
> > +	tpm_buf_reset_int(tpm2b);

This should only append. Unpredictable side-effect like this, will 
add by factors to the time spent maintaining all this.

For any extra steps, do them in the call site.

BR, Jarkko




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux