/* This is just for paranoia. */
assert(config->n_entries < IDX_MAX);
- if ((config->n_entries & 15) == 0) {
+ if ((config->n_entries & 15) == 0)
config->entries = xrealloc(
config->entries,
sizeof(void *) * config->n_entries,
sizeof(void *) * (config->n_entries + 16));
- }
config->entries[config->n_entries++] = entry;
}
/* If the extra input device we found returns something, always use that instead
* to work around broken firmware freezing on ConIn/ConInEx. */
- if (extraInEx && BS->CheckEvent(extraInEx->WaitForKeyEx) == EFI_SUCCESS) {
- conInEx = extraInEx;
- extraInEx = NULL;
- }
+ if (extraInEx && BS->CheckEvent(extraInEx->WaitForKeyEx) == EFI_SUCCESS)
+ conInEx = TAKE_PTR(extraInEx);
/* Do not fall back to ConIn if we have a ConIn that supports TextInputEx.
* The two may be out of sync on some firmware, giving us double input. */
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
0);
if (err != EFI_SUCCESS) {
- if (err != EFI_NOT_FOUND && err != EFI_WRITE_PROTECTED)
+ if (!IN_SET(err, EFI_NOT_FOUND, EFI_WRITE_PROTECTED))
log_error_status(err, "Failed to open random seed file: %m");
return err;
}
case 16:
case 32:
- if (dib->compression != 0 && dib->compression != 3)
+ if (!IN_SET(dib->compression, 0, 3))
return EFI_UNSUPPORTED;
break;
if (sz == 0) {
/* End of directory */
- free(*buffer);
- *buffer = NULL;
+ *buffer = mfree(*buffer);
*buffer_size = 0;
}
for (char16_t **i = v; *i; i++)
free(*i);
- free(v);
- return NULL;
+ return mfree(v);
}
EFI_STATUS open_directory(
siphash24_compress_string(strempty(ifname), &state);
siphash24_compress_byte(0, &state); /* separator */
n = htole64(n); /* add the 'index' to the mix in an endianess-independent fashion */
- siphash24_compress(&n, sizeof(n), &state);
+ siphash24_compress_typesafe(n, &state);
h = htole64(siphash24_finalize(&state));