[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150609113913.GA1079@jsakkine-mobl1>
Date: Tue, 9 Jun 2015 14:39:13 +0300
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Peter Huewe <peterhuewe@....de>
Cc: "moderated list:TPM DEVICE DRIVER"
<tpmdd-devel@...ts.sourceforge.net>, safford@...ibm.com,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [tpmdd-devel] [PATCH v2] tpm: introduce struct tpm_buf
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists