Reactos

[CMBATT] Grab the design voltage after the BIF data gets copied

There was a risk of accessing invalid data as the design voltage was grabbed before the read BIF data was copied into the device extension.

+2 -1
+2 -1
drivers/bus/acpi/cmbatt/cmbatt.c
··· 280 280 _In_ ULONG BatteryTag) 281 281 { 282 282 ACPI_BIF_DATA BifData; 283 - ULONG DesignVoltage = DeviceExtension->BifData.DesignVoltage; 283 + ULONG DesignVoltage; 284 284 PBATTERY_INFORMATION Info = &DeviceExtension->BatteryInformation; 285 285 NTSTATUS Status; 286 286 ··· 293 293 RtlCopyMemory(Info->Chemistry, BifData.BatteryType, 4); 294 294 // FIXME: take from _BIX method: Info->CycleCount 295 295 DeviceExtension->BifData = BifData; 296 + DesignVoltage = DeviceExtension->BifData.DesignVoltage; 296 297 297 298 /* Check if the power stats are reported in ampere or watts */ 298 299 if (BifData.PowerUnit == ACPI_BATT_POWER_UNIT_AMPS)