ehci: add sanity check for maxframes
PATCH 1/1 ehci: add sanity check for maxframes
Reported-by Peter Maydell <[email protected]>
Signed-off-by Gerd Hoffmann <[email protected]>
--- hw/usb/hcd-ehci.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/usb/hcd-ehci.c +5 -0
@@ -2483,6 +2483,11 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) NB_PORTS);return ; } +if (s->maxframes <8 || s->maxframes >512 ) { +error_setg (errp,"maxframes %d out if range (8 .. 512)" , + s->maxframes); +return ; + }usb_bus_new (&s->bus,sizeof (s->bus), s->companion_enable ? &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev);
Signature · 1 line
2.9.3
Quoted 11 lines · Gerd Hoffmann
Reported-by Peter Maydell <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>--- hw/usb/hcd-ehci.c | 5 +++++ 1 file changed, 5 insertions(+)hw/usb/hcd-ehci.c +0
-0
hw/usb/hcd-ehci.c void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) · line 2488
Quoted 6 lines
hw/usb/hcd-ehci.c +3
-0@@ -2483,6 +2483,11 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) NB_PORTS);return ; } +if (s->maxframes <8 || s->maxframes >512 ) { +error_setg (errp,"maxframes %d out if range (8 .. 512)" , + s->maxframes);
Typo: should be "of".
Quoted 7 lines
hw/usb/hcd-ehci.c +2
-1+return ; + }usb_bus_new (&s->bus,sizeof (s->bus), s->companion_enable ? &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev); --2.9.3
Otherwise
Reviewed-by Peter Maydell <[email protected]>
Do we want something similar for hcd-uhci just for consistency?
thanks
-- PMM