summaryrefslogtreecommitdiffstats
path: root/src/interface/smbios/smbios.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface/smbios/smbios.c')
-rw-r--r--src/interface/smbios/smbios.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/interface/smbios/smbios.c b/src/interface/smbios/smbios.c
index 1dcf819c2..12a080da2 100644
--- a/src/interface/smbios/smbios.c
+++ b/src/interface/smbios/smbios.c
@@ -130,8 +130,8 @@ int find_smbios_structure ( unsigned int type, unsigned int instance,
assert ( smbios.address != UNULL );
/* Scan through list of structures */
- while ( ( ( offset + sizeof ( structure->header ) ) < smbios.len )
- && ( count < smbios.count ) ) {
+ while ( ( ( offset + sizeof ( structure->header ) ) < smbios.len ) &&
+ ( ( smbios.count == 0 ) || ( count < smbios.count ) ) ) {
/* Read next SMBIOS structure header */
copy_from_user ( &structure->header, smbios.address, offset,
@@ -157,6 +157,11 @@ int find_smbios_structure ( unsigned int type, unsigned int instance,
"strings length %zx\n", offset, structure->header.type,
structure->header.len, structure->strings_len );
+ /* Stop if we have reached an end-of-table marker */
+ if ( ( smbios.count == 0 ) &&
+ ( structure->header.type == SMBIOS_TYPE_END ) )
+ break;
+
/* If this is the structure we want, return */
if ( ( structure->header.type == type ) &&
( instance-- == 0 ) ) {
@@ -250,3 +255,13 @@ int smbios_version ( void ) {
return smbios.version;
}
+
+/**
+ * Clear SMBIOS entry point descriptor
+ *
+ */
+void smbios_clear ( void ) {
+
+ /* Clear address */
+ smbios.address = UNULL;
+}