Previously the external DMI decoder did not allow this to happen because all possible pointers were initialized at startup by the output of 'dmidecode -s ...' which has default values for all supported types.
The now active internal DMI decoder does work differently: it scans the complete DMI table once and copies the available strings. Therefore, strings that are not set by the firmware are left at their default value of NULL.
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- dmi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dmi.c b/dmi.c index 14f3871..ef7ae2c 100644 --- a/dmi.c +++ b/dmi.c @@ -406,8 +406,8 @@ void dmi_init(void) * at the beginning and '$' at the end. So you can look for "^prefix", * "suffix$", "substring" or "^complete string$". * - * @param value The string to check. - * @param pattern The pattern. + * @param value The non-NULL string to check. + * @param pattern The non-NULL pattern. * @return Nonzero if pattern matches. */ static int dmi_compare(const char *value, const char *pattern) @@ -454,9 +454,13 @@ int dmi_match(const char *pattern) if (!has_dmi_support) return 0;
- for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) + for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) { + if (dmi_strings[i].value == NULL) + continue; + if (dmi_compare(dmi_strings[i].value, pattern)) return 1; + }
return 0; }