diff options
author | Peter Maydell | 2019-02-21 10:41:11 +0100 |
---|---|---|
committer | Peter Maydell | 2019-02-21 10:41:11 +0100 |
commit | 039e406603852e9ddb23b5965b6956d42304bc55 (patch) | |
tree | 6a706ed412d6546a25077931d14daae02c75eedb /hw/usb/hcd-ohci.c | |
parent | Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190219' into... (diff) | |
parent | usb: remove unnecessary NULL device check from usb_ep_get() (diff) | |
download | qemu-039e406603852e9ddb23b5965b6956d42304bc55.tar.gz qemu-039e406603852e9ddb23b5965b6956d42304bc55.tar.xz qemu-039e406603852e9ddb23b5965b6956d42304bc55.zip |
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20190220-pull-request' into staging
usb: usb_ep_get() fixes
# gpg: Signature made Wed 20 Feb 2019 11:13:32 GMT
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/usb-20190220-pull-request:
usb: remove unnecessary NULL device check from usb_ep_get()
usb: add device checks before redirector calls to usb_ep_get()
usb: check device is not NULL before calling usb_ep_get()
uhci: check device is not NULL before calling usb_ep_get()
ohci: check device is not NULL before calling usb_ep_get()
ehci: check device is not NULL before calling usb_ep_get()
xhci: check device is not NULL before calling usb_ep_get()
xhci: add asserts to help with static code analysis
usb: rearrange usb_ep_get()
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb/hcd-ohci.c')
-rw-r--r-- | hw/usb/hcd-ohci.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index c34cf5b73a..196a9f7200 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -848,6 +848,10 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, bool int_req = relative_frame_number == frame_count && OHCI_BM(iso_td.flags, TD_DI) == 0; dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA)); + if (dev == NULL) { + trace_usb_ohci_td_dev_error(); + return 1; + } ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN)); usb_packet_setup(&ohci->usb_packet, pid, ep, 0, addr, false, int_req); usb_packet_addbuf(&ohci->usb_packet, ohci->usb_buf, len); @@ -1071,6 +1075,10 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) return 1; } dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA)); + if (dev == NULL) { + trace_usb_ohci_td_dev_error(); + return 1; + } ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN)); usb_packet_setup(&ohci->usb_packet, pid, ep, 0, addr, !flag_r, OHCI_BM(td.flags, TD_DI) == 0); |