mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +00:00
Kernel/USB: Explicitely copy descriptor.hub_characteristics for printing
This field is in a packed struct, which makes it possibly misaligned. This knowledge is lost when invoking `dbgln` triggering an unaligned access to it, aka UB. By explicitely copying it we avoid this issue.
This commit is contained in:
parent
c9a4ab9987
commit
8335803045
|
@ -72,7 +72,7 @@ ErrorOr<void> Hub::enumerate_and_power_on_hub()
|
|||
if constexpr (USB_DEBUG) {
|
||||
dbgln("USB Hub Descriptor for {:04x}:{:04x}", m_vendor_id, m_product_id);
|
||||
dbgln("Number of Downstream Ports: {}", descriptor.number_of_downstream_ports);
|
||||
dbgln("Hub Characteristics: 0x{:04x}", descriptor.hub_characteristics);
|
||||
dbgln("Hub Characteristics: 0x{:04x}", static_cast<u16>(descriptor.hub_characteristics));
|
||||
dbgln("Power On to Power Good Time: {} ms ({} * 2ms)", descriptor.power_on_to_power_good_time * 2, descriptor.power_on_to_power_good_time);
|
||||
dbgln("Hub Controller Current: {} mA", descriptor.hub_controller_current);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue