1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:18:11 +00:00

Kernel/Storage: Make AHCI::HBA::port_regs a flexible array member

Some real hardware apparently uses smaller BAR sizes than sizeof(HBA)
with a completely filled port_regs member.
Change the port_regs array to a flexible array member, so we don't panic
while verifying that the BAR size is large enough to map this struct.
Accesses to this array are already bounds checked against
AHCI::Limits::MaxPorts.
This commit is contained in:
Sönke Holz 2024-02-20 23:40:53 +01:00 committed by Andrew Kaster
parent 6fd02d2a04
commit f85099ea47

View file

@ -401,7 +401,7 @@ struct [[gnu::packed]] HBA {
u8 reserved[52]; u8 reserved[52];
u8 nvmhci[64]; u8 nvmhci[64];
u8 vendor_specific[96]; u8 vendor_specific[96];
PortRegisters port_regs[32]; PortRegisters port_regs[];
}; };
struct [[gnu::packed]] CommandHeader { struct [[gnu::packed]] CommandHeader {