Bläddra i källkod

[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 år sedan
förälder
incheckning
031b30898a
1 ändrade filer med 2 tillägg och 4 borttagningar
  1. 2
    4
      src/arch/i386/firmware/pcbios/smbios.c

+ 2
- 4
src/arch/i386/firmware/pcbios/smbios.c Visa fil

@@ -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
 	}

Laddar…
Avbryt
Spara