mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
Kernel: Prevent integer overflow in USB::Hub::check_for_port_updates()
The maximum valid value is 255, so max + 1 doesn't fit in a u8.
This commit is contained in:
parent
80dad2d0b5
commit
b4cdd6a55c
1 changed files with 2 additions and 1 deletions
|
@ -145,7 +145,8 @@ void Hub::remove_children_from_sysfs()
|
||||||
|
|
||||||
void Hub::check_for_port_updates()
|
void Hub::check_for_port_updates()
|
||||||
{
|
{
|
||||||
for (u8 port_number = 1; port_number < m_hub_descriptor.number_of_downstream_ports + 1; ++port_number) {
|
for (u8 port_index = 0; port_index < m_hub_descriptor.number_of_downstream_ports; ++port_index) {
|
||||||
|
u8 port_number = port_index + 1;
|
||||||
dbgln_if(USB_DEBUG, "USB Hub: Checking for port updates on port {}...", port_number);
|
dbgln_if(USB_DEBUG, "USB Hub: Checking for port updates on port {}...", port_number);
|
||||||
|
|
||||||
HubStatus port_status {};
|
HubStatus port_status {};
|
||||||
|
|
Loading…
Reference in a new issue