From 0bf0f8716a3c7f85455707d8c2d727d130ee1024 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 23 Apr 2025 09:53:38 +0100 Subject: [smbios] Remove userptr_t from SMBIOS structure parsing Simplify the SMBIOS structure parsing code by assuming that all structure content is fully accessible via pointer dereferences. In particular, this allows the convoluted find_smbios_structure() and read_smbios_structure() to be combined into a single function smbios_structure() that just returns a direct pointer to the SMBIOS structure, with smbios_string() similarly now returning a direct pointer to the relevant string. Signed-off-by: Michael Brown --- src/interface/linux/linux_smbios.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/interface/linux') diff --git a/src/interface/linux/linux_smbios.c b/src/interface/linux/linux_smbios.c index abe1b19d7..a12c936ed 100644 --- a/src/interface/linux/linux_smbios.c +++ b/src/interface/linux/linux_smbios.c @@ -35,7 +35,7 @@ static const char smbios_entry_filename[] = static const char smbios_filename[] = "/sys/firmware/dmi/tables/DMI"; /** Cache SMBIOS data */ -static userptr_t smbios_data; +static void *smbios_data; /** * Find SMBIOS @@ -46,7 +46,7 @@ static userptr_t smbios_data; static int linux_find_smbios ( struct smbios *smbios ) { struct smbios3_entry *smbios3_entry; struct smbios_entry *smbios_entry; - userptr_t entry; + void *entry; void *data; int len; int rc; @@ -98,6 +98,7 @@ static int linux_find_smbios ( struct smbios *smbios ) { return 0; ufree ( smbios_data ); + smbios_data = NULL; err_read: err_version: ufree ( entry ); @@ -116,6 +117,7 @@ static void linux_smbios_shutdown ( int booting __unused ) { /* Free SMBIOS data */ ufree ( smbios_data ); + smbios_data = NULL; } /** SMBIOS shutdown function */ -- cgit v1.2.3-55-g7522