boot/efi: trivial coding style cleanups

Follow-ups for #34717 and #34718.
This commit is contained in:
Yu Watanabe
2024-10-13 05:51:23 +09:00
parent 1863eecff2
commit f87e02ba3f
2 changed files with 6 additions and 8 deletions
+5 -7
View File
@@ -186,13 +186,10 @@ const char* smbios_find_oem_string(const char *name) {
if (!type11)
return NULL;
const char *s = type11->contents;
assert(left >= type11->header.length); /* get_smbios_table() already validated this */
left -= type11->header.length;
const char *limit = s + left;
for (const char *p = s; p < limit; ) {
for (const char *p = type11->contents, *limit = type11->contents + left; p < limit; ) {
const char *e = memchr(p, 0, limit - p);
if (!e || e == p) /* Double NUL byte means we've reached the end of the OEM strings. */
break;
@@ -208,8 +205,7 @@ const char* smbios_find_oem_string(const char *name) {
}
static const char* smbios_get_string(const SmbiosHeader *header, size_t nr, uint64_t left) {
assert(header);
const char *s = (const char *) header;
const char *s = (const char *) ASSERT_PTR(header);
/* We assume that get_smbios_table() already validated the header size making some superficial sense */
assert(left >= header->length);
@@ -227,13 +223,15 @@ static const char* smbios_get_string(const SmbiosHeader *header, size_t nr, uint
p = e + 1;
}
return NULL;
}
void smbios_raw_info_populate(RawSmbiosInfo *ret_info) {
assert(ret_info);
uint64_t left;
assert(ret_info);
const SmbiosTableType1 *type1 = (const SmbiosTableType1 *) get_smbios_table(1, sizeof(SmbiosTableType1), &left);
if (type1) {
ret_info->manufacturer = smbios_get_string(&type1->header, type1->manufacturer, left);
+1 -1
View File
@@ -4,8 +4,8 @@
#include "efi.h"
#include "efi-string.h"
#include "log.h"
#include "proto/file-io.h"
#include "memory-util-fundamental.h"
#include "proto/file-io.h"
#include "string-util-fundamental.h"
/* This is provided by the linker. */