mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-28 14:43:37 +02:00
Address "ignoring number of bytes read" messages
Coverity complains about the existing "if (!fread(....))" and inverse syntax. Change it to make Coverity happy. Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
ad1d5e3f67
commit
84a423d5a1
@ -2011,7 +2011,7 @@ static int ima_measurement(const char *file)
|
||||
}
|
||||
}
|
||||
|
||||
while (fread(&entry.header, sizeof(entry.header), 1, fp)) {
|
||||
while (fread(&entry.header, sizeof(entry.header), 1, fp) == 1) {
|
||||
entry_num++;
|
||||
if (entry.header.pcr >= NUM_PCRS) {
|
||||
log_err("Invalid PCR %d.\n", entry.header.pcr);
|
||||
@ -2233,7 +2233,7 @@ static int read_binary_bios_measurements(char *file, struct tpm_bank_info *bank)
|
||||
log_info("Reading the TPM 1.2 event log %s.\n", file);
|
||||
|
||||
/* Extend the pseudo TPM PCRs with the event digest */
|
||||
while (fread(&event, sizeof(event.header), 1, fp)) {
|
||||
while (fread(&event, sizeof(event.header), 1, fp) == 1) {
|
||||
if (imaevm_params.verbose > LOG_INFO) {
|
||||
log_info("%02u ", event.header.pcr);
|
||||
log_dump(event.header.digest, SHA_DIGEST_LENGTH);
|
||||
|
@ -156,7 +156,7 @@ static int add_file_hash(const char *file, EVP_MD_CTX *ctx)
|
||||
|
||||
for (size = stats.st_size; size; size -= len) {
|
||||
len = MIN(size, bs);
|
||||
if (!fread(data, len, 1, fp)) {
|
||||
if (fread(data, len, 1, fp) != 1) {
|
||||
if (ferror(fp)) {
|
||||
log_err("fread() failed\n\n");
|
||||
goto out;
|
||||
|
Loading…
x
Reference in New Issue
Block a user