From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: [PATCH 6/6] tpm2: add session handle context saving and restoring to the space code Date: Fri, 10 Feb 2017 08:17:11 -0800 Message-ID: <1486743431.2502.6.camel@HansenPartnership.com> References: <20170208110713.14070-1-jarkko.sakkinen@linux.intel.com> <20170208110713.14070-7-jarkko.sakkinen@linux.intel.com> <20170210123249.nrppoez2kdr2q4nw@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170210123249.nrppoez2kdr2q4nw-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jarkko Sakkinen , tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, open list List-Id: tpmdd-devel@lists.sourceforge.net On Fri, 2017-02-10 at 14:32 +0200, Jarkko Sakkinen wrote: > On Wed, Feb 08, 2017 at 01:07:08PM +0200, Jarkko Sakkinen wrote: > > From: James Bottomley [...] > > +static int tpm2_session_add(struct tpm_chip *chip, u32 handle) > > +{ > > + struct tpm_space *space = &chip->work_space; > > + int i; > > + > > + for (i = 0; i < ARRAY_SIZE(space->session_tbl); i++) > > + if (space->session_tbl[i] == 0) > > + break; > > + if (i == ARRAY_SIZE(space->session_tbl)) { > > + dev_err(&chip->dev, "out of session slots\n"); > > This really should be dev_dbg. This was my reply to the comment the last time: I can do that, but I think this should be higher than debug. If this trips, something an application was doing will fail with a non TPM error and someone may wish to investigate why. Having a kernel message would help with that (but they won't see it if it's debug). I'm also leaning towards the idea that we should actually have one more _tbl slot than we know the TPM does, so that if someone goes over it's the TPM that gives them a real TPM out of memory error rather than the space code returning -ENOMEM. If you agree, I think it should be four for both sessions_tbl and context_tbl. So I really don't think it should be debug. Could we compromise on dev_info? James ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot