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;
}
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);
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);
#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. */