diff options
-rw-r--r-- | arch/i386/kernel/dmi_scan.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index ecdaae262755..ae1a1aed2fc0 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -16,15 +16,25 @@ struct dmi_header { | |||
16 | static char * __init dmi_string(struct dmi_header *dm, u8 s) | 16 | static char * __init dmi_string(struct dmi_header *dm, u8 s) |
17 | { | 17 | { |
18 | u8 *bp = ((u8 *) dm) + dm->length; | 18 | u8 *bp = ((u8 *) dm) + dm->length; |
19 | char *str = ""; | ||
19 | 20 | ||
20 | if (!s) | 21 | if (s) { |
21 | return ""; | ||
22 | s--; | ||
23 | while (s > 0 && *bp) { | ||
24 | bp += strlen(bp) + 1; | ||
25 | s--; | 22 | s--; |
26 | } | 23 | while (s > 0 && *bp) { |
27 | return bp; | 24 | bp += strlen(bp) + 1; |
25 | s--; | ||
26 | } | ||
27 | |||
28 | if (*bp != 0) { | ||
29 | str = alloc_bootmem(strlen(bp) + 1); | ||
30 | if (str != NULL) | ||
31 | strcpy(str, bp); | ||
32 | else | ||
33 | printk(KERN_ERR "dmi_string: out of memory.\n"); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | return str; | ||
28 | } | 38 | } |
29 | 39 | ||
30 | /* | 40 | /* |
@@ -84,19 +94,16 @@ static char *dmi_ident[DMI_STRING_MAX]; | |||
84 | */ | 94 | */ |
85 | static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) | 95 | static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) |
86 | { | 96 | { |
87 | char *d = (char*)dm; | 97 | char *p, *d = (char*) dm; |
88 | char *p = dmi_string(dm, d[string]); | ||
89 | 98 | ||
90 | if (p == NULL || *p == 0) | ||
91 | return; | ||
92 | if (dmi_ident[slot]) | 99 | if (dmi_ident[slot]) |
93 | return; | 100 | return; |
94 | 101 | ||
95 | dmi_ident[slot] = alloc_bootmem(strlen(p) + 1); | 102 | p = dmi_string(dm, d[string]); |
96 | if(dmi_ident[slot]) | 103 | if (p == NULL) |
97 | strcpy(dmi_ident[slot], p); | 104 | return; |
98 | else | 105 | |
99 | printk(KERN_ERR "dmi_save_ident: out of memory.\n"); | 106 | dmi_ident[slot] = p; |
100 | } | 107 | } |
101 | 108 | ||
102 | /* | 109 | /* |