Bladeren bron

[smbios] Fix SMBIOS string fetching

A bug in read_smbios_string() was causing the starting offset of the
SMBIOS structure to be added twice, resulting in completely the wrong
strings being returned.

Bug identified by Martin Herweg <m.herweg@gmx.de>
tags/v0.9.4
Michael Brown 16 jaren geleden
bovenliggende
commit
031b30898a
1 gewijzigde bestanden met toevoegingen van 2 en 4 verwijderingen
  1. 2
    4
      src/arch/i386/firmware/pcbios/smbios.c

+ 2
- 4
src/arch/i386/firmware/pcbios/smbios.c Bestand weergeven

@@ -275,14 +275,12 @@ int read_smbios_string ( struct smbios_structure *structure,
275 275
 		 * smbios_strings struct is constructed so as to
276 276
 		 * always end on a string boundary.
277 277
 		 */
278
-		string_len = strlen_user ( smbios.address,
279
-					   ( structure->offset + offset ) );
278
+		string_len = strlen_user ( smbios.address, offset );
280 279
 		if ( --index == 0 ) {
281 280
 			/* Copy string, truncating as necessary. */
282 281
 			if ( len > string_len )
283 282
 				len = string_len;
284
-			copy_from_user ( data, smbios.address,
285
-					 ( structure->offset + offset ), len );
283
+			copy_from_user ( data, smbios.address, offset, len );
286 284
 			return string_len;
287 285
 		}
288 286
 	}

Laden…
Annuleren
Opslaan