Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754220AbbELVTV (ORCPT ); Tue, 12 May 2015 17:19:21 -0400 Received: from e18.ny.us.ibm.com ([129.33.205.208]:48781 "EHLO e18.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754040AbbELVTR (ORCPT ); Tue, 12 May 2015 17:19:17 -0400 Subject: Re: [tpmdd-devel] [PATCH 1/3] vTPM: fixed the limit checking From: "Joy M. Latten" To: Stefan Berger Cc: "Hon Ching(Vicky) Lo" , tpmdd-devel@lists.sourceforge.net, Ashley Lai , linux-kernel@vger.kernel.org, Peter Huewe In-Reply-To: <5550A84D.1080901@linux.vnet.ibm.com> References: <1430873486-25868-1-git-send-email-honclo@linux.vnet.ibm.com> <1430873486-25868-2-git-send-email-honclo@linux.vnet.ibm.com> <5550A84D.1080901@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 12 May 2015 16:19:12 -0500 Message-ID: <1431465552.7420.8.camel@oc8377654763.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-30.el6) Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15051221-0045-0000-0000-000000296DD6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2141 Lines: 67 Hi Stefan, On Mon, 2015-05-11 at 09:02 -0400, Stefan Berger wrote: > On 05/05/2015 08:51 PM, Hon Ching(Vicky) Lo wrote: > > Do not skip the last entry of the event log. > > > > Signed-off-by: Hon Ching(Vicky) Lo > > Signed-off-by: Joy Latten > > > > Changelog: > > - remove redundant code > > --- > > drivers/char/tpm/tpm_eventlog.c | 5 +---- > > 1 files changed, 1 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c > > index 3a56a13..e77d8c1 100644 > > --- a/drivers/char/tpm/tpm_eventlog.c > > +++ b/drivers/char/tpm/tpm_eventlog.c > > @@ -116,11 +116,8 @@ static void *tpm_bios_measurements_next(struct seq_file *m, void *v, > > > > event = v; > > > > - if (event->event_type == 0 && event->event_size == 0) > > - return NULL; > > - > > if ((event->event_type == 0 && event->event_size == 0) || > > - ((v + sizeof(struct tcpa_event) + event->event_size) >= limit)) > > + ((v + sizeof(struct tcpa_event) + event->event_size) > limit)) > > return NULL; > > > > (*pos)++; > > The limit stems from log->bios_event_log_end and is calculated as follows: > > log->bios_event_log_end = log->bios_event_log + len; > > The '>=' above is correct since the limit address itself is not part of > the log anymore. > > The log is the following sequence of addresses: > > [log->bios_event_log ... log->bios_event_log + len - 1 ] > > or > > [log->bios_event_log ... log->bios_event_log + len [ > > with ']' meaning inclusive and '[' meaning exclusive. > Thanks for pointing this out... you are correct. We are just seeing where the spec describes this. On powerpc(p8/powervm)) using vtpm, the last entry doesn't get shown when ">=", so I suspect phype may be giving us an "inclusive" len. Vicky and I will investigate this. regards, Joy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/