Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753924AbbEKNCO (ORCPT ); Mon, 11 May 2015 09:02:14 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:44027 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753887AbbEKNCM (ORCPT ); Mon, 11 May 2015 09:02:12 -0400 Message-ID: <5550A84D.1080901@linux.vnet.ibm.com> Date: Mon, 11 May 2015 09:02:05 -0400 From: Stefan Berger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "Hon Ching(Vicky) Lo" , tpmdd-devel@lists.sourceforge.net CC: Joy Latten , Ashley Lai , linux-kernel@vger.kernel.org, Peter Huewe Subject: Re: [tpmdd-devel] [PATCH 1/3] vTPM: fixed the limit checking References: <1430873486-25868-1-git-send-email-honclo@linux.vnet.ibm.com> <1430873486-25868-2-git-send-email-honclo@linux.vnet.ibm.com> In-Reply-To: <1430873486-25868-2-git-send-email-honclo@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15051113-8236-0000-0000-00000B61DD90 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1703 Lines: 54 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. Stefan -- 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/