[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANc+2y523PgF_-ynp2xuor_2RUGLFhnK14F-Wf5i5hwRDmk_Fw@mail.gmail.com>
Date: Tue, 24 Oct 2017 23:26:52 +0530
From: PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>
To: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Stefan Berger <stefanb@...ux.vnet.ibm.com>,
linux-integrity@...r.kernel.org,
David Howells <dhowells@...hat.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"open list:INTEGRITY MEASUREMENT ARCHITECTURE IMA"
<linux-ima-user@...ts.sourceforge.net>,
Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
open list <linux-kernel@...r.kernel.org>,
linux-security-module@...r.kernel.org,
"moderated list:TPM DEVICE DRIVER"
<tpmdd-devel@...ts.sourceforge.net>,
"open list:KEYS-TRUSTED" <keyrings@...r.kernel.org>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@...r.kernel.org>,
James Morris <james.l.morris@...cle.com>,
Matt Mackall <mpm@...enic.com>,
"open list:INTEGRITY MEASUREMENT ARCHITECTURE IMA"
<linux-ima-devel@...ts.sourceforge.net>,
David Safford <safford@...ibm.com>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
"Serge E. Hallyn" <serge@...lyn.com>
Subject: Re: [tpmdd-devel] [PATCH] tpm: remove chip_num parameter from
in-kernel API
Hi Jason,
On 24 October 2017 at 23:16, Jason Gunthorpe
<jgunthorpe@...idianresearch.com> wrote:
> On Tue, Oct 24, 2017 at 09:44:30PM +0530, PrasannaKumar Muralidharan wrote:
>
>> I am wondering why it is wrong. Isn't the chip id valid till it is
>> unregistered? If so the rfc is correct. Please explain, may be I am
>> missing something.
>
> The lifetime is a bit complicated, but the general rule in the kernel
> for things like this it to use pointers, not ids, and certainly not
> string ids.
>
> For that patch it could just use container_of to get the chip..
>
> Jason
hwrng requires a unique name for every device. In that patch
"tpm-rng-<chip_num>" is used. chip_num is nothing but dev->dev_num.
This way more than 1 tpm chip can be used as rng provider.
tpm_get_random uses chip_num as its parameter. This is why
chip->dev_num was used.
Is that reasoning correct?
Please feel free to correct me if I am wrong.
Thanks,
PrasannaKumar
Powered by blists - more mailing lists