[U-Boot] [U-Boot,1/2] tpm: sandbox: fix wrong check on pcr_map
Tom Rini
trini at konsulko.com
Mon Aug 13 23:57:50 UTC 2018
On Sun, Aug 05, 2018 at 06:53:06PM +0200, Miquel Raynal wrote:
> The second check on pcr_map in sandbox_tpm2_xfer() is wrong. It should
> check for pcr_map not being empty. Instead, it is a pure copy/paste of
> the first check which is redundant.
>
> This has been found thanks to a Coverity Scan report:
>
> CID 183370: Memory - illegal accesses (UNINIT)
> Using uninitialized value "pcr_index".
> put_unaligned_be32(tpm->pcr_extensions[pcr_index], recv);
>
> This is because pcr_index is initialized only if the user input is
> correct, ie. at least one valid bit is set in pcr_map.
>
> Fix the second check and also initialize pcr_index to 0 (which is
> harmless in case of error) to make Coverity Scan happy.
>
> Reported-by: Tom Rini <trini at konsulko.com>
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180813/186a3b20/attachment.sig>
More information about the U-Boot
mailing list