boot/efi: trivial coding style cleanups
Follow-ups for #34717 and #34718.
This commit is contained in:
@@ -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
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user