ACK: [PATCH] tpmevlogdump: clean up some minor cppcheck style warnings
Alex Hung
alex.hung at canonical.com
Thu Jan 14 19:59:19 UTC 2021
On 2021-01-14 7:58 a.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Reduce the scope of some variables. Cleans up the following
> cppcheck style warnings:
>
> src/tpm/tpmevlogdump/tpmevlogdump.c:377:8: style: The scope
> of the variable 'str_info' can be reduced. [variableScope]
> char *str_info;
>
> src/tpm/tpmevlogdump/tpmevlogdump.c:471:13: style: The scope
> of the variable 'data' can be reduced. [variableScope]
> uint8_t *data;
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/tpm/tpmevlogdump/tpmevlogdump.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/tpm/tpmevlogdump/tpmevlogdump.c b/src/tpm/tpmevlogdump/tpmevlogdump.c
> index 47c3f38e..612c1e4e 100644
> --- a/src/tpm/tpmevlogdump/tpmevlogdump.c
> +++ b/src/tpm/tpmevlogdump/tpmevlogdump.c
> @@ -374,10 +374,11 @@ static void tpmevlogdump_event_dump(fwts_framework *fw, uint8_t *data, size_t le
> {
>
> uint8_t *pdata = data;
> - char *str_info;
> fwts_pc_client_pcr_event *pc_event = NULL;
>
> while (len > 0) {
> + char *str_info;
> +
> /* check the data length for dumping */
> if (len < sizeof(fwts_pc_client_pcr_event)) {
> fwts_log_info(fw,
> @@ -468,7 +469,6 @@ static int tpmevlogdump_test1(fwts_framework *fw)
> tpmdir = readdir(dir);
> if (tpmdir && strstr(tpmdir->d_name, "tpm")) {
> char path[PATH_MAX];
> - uint8_t *data;
> int fd;
> size_t length;
>
> @@ -478,6 +478,8 @@ static int tpmevlogdump_test1(fwts_framework *fw)
> snprintf(path, sizeof(path), FWTS_TPM_LOG_DIR_PATH "/%s/binary_bios_measurements", tpmdir->d_name);
>
> if ((fd = open(path, O_RDONLY)) >= 0) {
> + uint8_t *data;
> +
> data = tpmevlogdump_load_file(fd, &length);
> tpm_logfile_found = true;
> if (data == NULL) {
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list