From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4026AC10F14 for ; Tue, 23 Apr 2019 11:45:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 172B720811 for ; Tue, 23 Apr 2019 11:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726443AbfDWLpG (ORCPT ); Tue, 23 Apr 2019 07:45:06 -0400 Received: from mga18.intel.com ([134.134.136.126]:29601 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfDWLpG (ORCPT ); Tue, 23 Apr 2019 07:45:06 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 04:45:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,385,1549958400"; d="scan'208";a="339973591" Received: from rafaelro-mobl4.amr.corp.intel.com (HELO localhost) ([10.249.45.214]) by fmsmga005.fm.intel.com with ESMTP; 23 Apr 2019 04:45:04 -0700 Date: Tue, 23 Apr 2019 14:45:02 +0300 From: Jarkko Sakkinen To: Sasha Levin Cc: stable@vger.kernel.org, Yue Haibing Subject: Re: [PATCH] tpm: Fix the type of the return value in calc_tpm2_event_size() Message-ID: <20190423114445.GB4499@linux.intel.com> References: <20190417152420.18170-1-jarkko.sakkinen@linux.intel.com> <20190417170041.GE435@sasha-vm> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190417170041.GE435@sasha-vm> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, Apr 17, 2019 at 01:00:41PM -0400, Sasha Levin wrote: > On Wed, Apr 17, 2019 at 06:24:20PM +0300, Jarkko Sakkinen wrote: > > From: Yue Haibing > > > > commit 32312418625764cdf740890ac9c78ca26a6a9d24 upstream > > > > calc_tpm2_event_size() has an invalid signature because > > it returns a 'size_t' where as its signature says that > > it returns 'int'. > > > > Cc: > > Fixes: 4d23cc323cdb ("tpm: add securityfs support for TPM 2.0 firmware event log") > > Suggested-by: Jarkko Sakkinen > > Signed-off-by: Yue Haibing > > Reviewed-by: Jarkko Sakkinen > > Signed-off-by: Jarkko Sakkinen > > --- > > backport v5.0.8 > > drivers/char/tpm/eventlog/tpm2.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/char/tpm/eventlog/tpm2.c b/drivers/char/tpm/eventlog/tpm2.c > > index 1b8fa9de2cac..130c3f227559 100644 > > --- a/drivers/char/tpm/eventlog/tpm2.c > > +++ b/drivers/char/tpm/eventlog/tpm2.c > > @@ -37,8 +37,8 @@ > > * > > * Returns size of the event. If it is an invalid event, returns 0. > > */ > > -static int calc_tpm2_event_size(struct tcg_pcr_event2 *event, > > - struct tcg_pcr_event *event_header) > > +static size_t calc_tpm2_event_size(struct tcg_pcr_event2_head *event, > > + struct tcg_pcr_event *event_header) > > { > > struct tcg_efi_specid_event *efispecid; > > struct tcg_event_field *event_field; > > But it seems like it breaks the build: > > drivers/char/tpm/eventlog/tpm2.c:40:43: warning: ‘struct tcg_pcr_event2_head’ declared inside parameter list will not be visible outside of this definition or declaration > static size_t calc_tpm2_event_size(struct tcg_pcr_event2_head *event, > ^~~~~~~~~~~~~~~~~~~ > drivers/char/tpm/eventlog/tpm2.c: In function ‘calc_tpm2_event_size’: > drivers/char/tpm/eventlog/tpm2.c:55:32: error: dereferencing pointer to incomplete type ‘struct tcg_pcr_event2_head’ > marker = marker + sizeof(event->pcr_idx) + sizeof(event->event_type) > > Probably because c8faabfc6f480 is missing. I've reverted this patch from > stable for now. Ugh. I'm for this weekend on leave. Looking this next week. Sorry about wasted time :-( /Jarkko