Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp77535imu; Thu, 8 Nov 2018 15:09:00 -0800 (PST) X-Google-Smtp-Source: AJdET5frUHoEDmc2Vx7dLNuONt/h9UaKqbcql6dmJqgTplgwFXRNTKzhaNcUPbz485EMbkGlSL+o X-Received: by 2002:a63:af45:: with SMTP id s5-v6mr5411405pgo.125.1541718539927; Thu, 08 Nov 2018 15:08:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541718539; cv=none; d=google.com; s=arc-20160816; b=Ux1PEhM/tnVXU4UkGz2/zTZ7qG/38F5C/+ZWQvyotI0VS91wBV0oc4tVNf+LX/HDCC 0ThKv0u0gMXvDg3HjwIJIWQ/KdtheJl6wdi/Y3A2CGRxrbzlYf28CEU1pwYE3eKMqTbu vF9JLOZ+5/BcsTZ7nYLb+IeS9893OB0jxDX8oqtQOLyPL9wqUnUB8CVPmk4n6C3Ea0e5 z/tk2OJwqyNMdJEYEvBE452T+eqiUk7J9Zq7VICHGlIm0+jThR5XJrIs2cVHOPdiZfV9 IgFPnz+BjreGtyuumceN2wf8DzZAmh/uKFE/2ro3wGvYxWd/V+0GRwqbFEp0JopaLudJ QHhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yQeI5mxvzQB7UPv1vMFVYj2aVOZEuVm12wBMmlbbVFU=; b=j65zfTAzzvAyWAFM8islmrHF1vdStUy9nQ7LTSuW1O6rHvHEe65jT0Qcptg8cRcyB1 Cn7K8itb9HkGS0rMAmKBDbEroq30QX1uA6JMJ8ftBHrvdsu/64P9LKMuCddrAjEijIL0 wHBdgwo/uoXkXXhwopdkCVDyEE6gMRZm87jkID8dWO7b23uT4CMnIi1EuUiydfwj7Fyx 37fnxYYIVHD+owXSIiU5qXKiM08sgH4dKWPbctPAD1nec1TmU32/B9hyksueDjO+um1K vCH6pO06CDMZu7PsQ4UxypA8VNKtncSk1AGSNOxcfWA7Dzdgd1A8Y/7R8x6NJ1CYYxFa dQmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si1297217pgr.346.2018.11.08.15.08.44; Thu, 08 Nov 2018 15:08:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727473AbeKIIpo (ORCPT + 99 others); Fri, 9 Nov 2018 03:45:44 -0500 Received: from mga11.intel.com ([192.55.52.93]:27208 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbeKIIpo (ORCPT ); Fri, 9 Nov 2018 03:45:44 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 15:07:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,481,1534834800"; d="scan'208";a="85059612" Received: from carstenv-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.134]) by fmsmga008.fm.intel.com with ESMTP; 08 Nov 2018 15:07:50 -0800 Date: Fri, 9 Nov 2018 01:07:49 +0200 From: Jarkko Sakkinen To: "Winkler, Tomas" Cc: "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , James Bottomley , "Struk, Tadeusz" , Stefan Berger , Nayna Jain , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , open list Subject: Re: [PATCH v5 09/17] tpm: move tpm_validate_commmand() to tpm2-space.c Message-ID: <20181108230749.GB8038@linux.intel.com> References: <20181108141541.12832-1-jarkko.sakkinen@linux.intel.com> <20181108141541.12832-10-jarkko.sakkinen@linux.intel.com> <5B8DA87D05A7694D9FA63FD143655C1B9DA18589@hasmsx108.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B9DA18589@hasmsx108.ger.corp.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 08, 2018 at 05:03:29PM +0000, Winkler, Tomas wrote: > You initialized cc under if only > > + > > + i = tpm2_find_cc(chip, cc); > > + if (i < 0) { > > + dev_dbg(&chip->dev, "0x%04X is an invalid > > command\n", > > + cc); > > + return -EOPNOTSUPP; > > + } > > + > > + attrs = chip->cc_attrs_tbl[i]; > > + nr_handles = > > + 4 * ((attrs >> TPM2_CC_ATTR_CHANDLES) & > > GENMASK(2, 0)); > > + if (len < TPM_HEADER_SIZE + 4 * nr_handles) > > + goto err_len; > > + } > > + > > + return cc; > You can return uninitialized cc here. Thanks, good catch. /Jarkko