diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-08-05 18:53:07 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-08-13 14:04:04 -0400 |
commit | 46703cd9f383ea4175d1f231651f9edcfa51a423 (patch) | |
tree | 43ed1c70b566d5ed2b2fb54cab6f0d35f9d7b20e /Kconfig | |
parent | fd973ca6969e556bfeb74e69c5a6867785c9ea5c (diff) | |
download | u-boot-46703cd9f383ea4175d1f231651f9edcfa51a423.zip u-boot-46703cd9f383ea4175d1f231651f9edcfa51a423.tar.gz u-boot-46703cd9f383ea4175d1f231651f9edcfa51a423.tar.bz2 |
tpm: sandbox: fix wrong assignment with a simplification
The recv variable in sandbox_tpm2_fill_buf() is a pointer on a pointer
of a char array. It means accessing *recv is the char array pointer
itself while **recv is the first character of that array. There is no
need for such indirection here, so simplify the code.
Simplifying things will make the last assignment right: "*recv = NULL"
is now correct. The issue has been found by the following Coverity
Scan report:
CID 183371: Incorrect expression (UNUSED_VALUE)
Assigning value "4UL" to "*recv" here, but that stored value is overwritten before it can be used.
232 *recv += sizeof(rc);
233
234 /* Add trailing \0 */
235 *recv = NULL;
While at simplifying things, use '\0' instead of NULL when adding an
empty char at the end of the buffer.
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'Kconfig')
0 files changed, 0 insertions, 0 deletions