lkml.org 
[lkml]   [2015]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [tpmdd-devel] [PATCH v2] tpm: introduce struct tpm_buf
From
Date


Hi

>> > +static inline void tpm_buf_store(struct tpm_buf *buf,
>> > + unsigned int pos,
>> > + const unsigned char *data,
>> > + unsigned int len)
>> > +{
>> > + BUG_ON((pos + len) > TPM_BUF_SIZE);
>> > +
>> > + memcpy(&buf->data[pos], data, len);
>> > +}
>>
>> Don't you have to update the ->length here?
>
>No. Store is for placing value in position, not appending to the end.
>
Then either add a length check (whether ->length is big enough) and/or call the function "update"

Peter



\
 
 \ /
  Last update: 2015-06-09 12:41    [W:0.047 / U:1.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site