[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120727193654.GA11027@linux.vnet.ibm.com>
Date: Fri, 27 Jul 2012 14:36:54 -0500
From: Kent Yoder <key@...ux.vnet.ibm.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: James Morris <jmorris@...ei.org>, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
tpmdd-devel@...ts.sourceforge.net,
Peter Huewe <peter.huewe@...ineon.com>,
Bryan Freed <bfreed@...omium.org>
Subject: Re: [GIT PULL] New TPM driver, hwrng driver and fixes
> Since you no longer modify *max anywhere in this function, why leave it
> a pointer? Making it pass by value seems more logical at that point
> (and cleaner).
>
> The only consumer which can make use of partial result is
> tpm_rng_read(), but that will now return zero unless the buffer is filled.
>
> My suggestion would be to drop the pointer and instead return a positive
> result (number of bytes) if you read anything and a negative result
> (-errno) on error.
Sounds good. I'll make this change.
Kent
> That way, a caller which can only use an exact number of bytes should do:
>
> rv = tpm_get_random(chip, buf, size);
> if (rv != size)
> /* error! */
>
> ... and tpm_rng_read() can do something smarter.
>
> -hpa
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists