linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Peter Huewe <peterhuewe@gmx.de>
Cc: "moderated list:TPM DEVICE DRIVER" 
	<tpmdd-devel@lists.sourceforge.net>,
	safford@us.ibm.com, open list <linux-kernel@vger.kernel.org>
Subject: Re: [tpmdd-devel] [PATCH v2] tpm: introduce struct tpm_buf
Date: Tue, 9 Jun 2015 14:39:13 +0300	[thread overview]
Message-ID: <20150609113913.GA1079@jsakkine-mobl1> (raw)
In-Reply-To: <1C403FBE-76FF-425C-8627-5956838CD560@gmx.de>

On Tue, Jun 09, 2015 at 12:32:57PM +0200, Peter Huewe wrote:
> 
> 
> 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"

There is a length check in the beginning (first line of the function
body).

> Peter

/Jarkko

  reply	other threads:[~2015-06-09 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 16:39 [PATCH v2] tpm: introduce struct tpm_buf Jarkko Sakkinen
2015-06-08 20:39 ` Peter Hüwe
2015-06-09  9:19   ` Jarkko Sakkinen
2015-06-09 10:32     ` [tpmdd-devel] " Peter Huewe
2015-06-09 11:39       ` Jarkko Sakkinen [this message]
2015-06-09 11:58         ` Peter Huewe
2015-06-09 12:05           ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150609113913.GA1079@jsakkine-mobl1 \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=safford@us.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).