qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 56090d: usb: rearrange usb_ep_get()


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 56090d: usb: rearrange usb_ep_get()
Date: Thu, 21 Feb 2019 05:09:16 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 56090d78a799015adadde759ee5de9e7b292126a
      
https://github.com/qemu/qemu/commit/56090d78a799015adadde759ee5de9e7b292126a
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/core.c

  Log Message:
  -----------
  usb: rearrange usb_ep_get()

There is no need to calculate the 'eps' variable in usb_ep_get()
if 'ep' is the control endpoint.  Instead the calculation should
be done after validating the input before returning an entry
indexed by the endpoint 'ep'.

Signed-off-by: Liam Merwick <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Reviewed-by: Mark Kanda <address@hidden>
Reviewed-by: Ameya More <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 92cf34279ce907cabf6cb0626ad8a9076eeab9b2
      
https://github.com/qemu/qemu/commit/92cf34279ce907cabf6cb0626ad8a9076eeab9b2
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: add asserts to help with static code analysis

Most callers of xhci_port_update() and xhci_wakeup() pass in a pointer
to an array entry and can never be NULL but add two defensive asserts
to protect against future changes (e.g. adding a new port speed, etc.)
adding a path through xhci_lookup_port() that could result in the
return of a NULL XHCIPort.

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 7cb513aa34fe5639c71223f06b2b6c7934815317
      
https://github.com/qemu/qemu/commit/7cb513aa34fe5639c71223f06b2b6c7934815317
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: check device is not NULL before calling usb_ep_get()

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: e94682f1febe3cc95cbe144137dd35eae39dc1e0
      
https://github.com/qemu/qemu/commit/e94682f1febe3cc95cbe144137dd35eae39dc1e0
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: check device is not NULL before calling usb_ep_get()

In ehci_process_itd(), the call to ehci_find_device() can return NULL
if it doesn't find a device matching 'devaddr' so explicitly check
the return value before passing it to usb_ep_get().

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 42340fc31f1533207bfd53f9d922624c4fbcf91d
      
https://github.com/qemu/qemu/commit/42340fc31f1533207bfd53f9d922624c4fbcf91d
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/hcd-ohci.c

  Log Message:
  -----------
  ohci: check device is not NULL before calling usb_ep_get()

A call to ohci_find_device() can return NULL if it doesn't find a
device matching 'addr' so for the two callers, explicitly check
the return value before passing it to usb_ep_get().

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: ff668537b6ec172b797091d11a228a97c4bfca8e
      
https://github.com/qemu/qemu/commit/ff668537b6ec172b797091d11a228a97c4bfca8e
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: check device is not NULL before calling usb_ep_get()

In uhci_handle_td(), the call to ehci_find_device() can return NULL
if it doesn't find a device matching 'addr' so explicitly check
the return value before passing it to usb_ep_get().

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: e87fd1e6e547a80b3e403e882b829d2750e24e44
      
https://github.com/qemu/qemu/commit/e87fd1e6e547a80b3e403e882b829d2750e24e44
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/hcd-musb.c

  Log Message:
  -----------
  usb: check device is not NULL before calling usb_ep_get()

In musb_packet(), the call to usb_find_device() can return NULL
if it doesn't find a device matching 'addr' so explicitly check
the return value before passing it to usb_ep_get().  This then
allows the subsequent calculation of 'id' to be streamlined.

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 4fc12aa1fcc212e47a695b4cd34e75f3dab7d7d7
      
https://github.com/qemu/qemu/commit/4fc12aa1fcc212e47a695b4cd34e75f3dab7d7d7
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/redirect.c

  Log Message:
  -----------
  usb: add device checks before redirector calls to usb_ep_get()

Add an assert and an explicit check before the two callers to
usb_ep_get() in the USB redirector code to ensure the device
passed in is not NULL.

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 7011baece29d0e197c54c4e57326ba88e67a4949
      
https://github.com/qemu/qemu/commit/7011baece29d0e197c54c4e57326ba88e67a4949
  Author: Liam Merwick <address@hidden>
  Date:   2019-02-20 (Wed, 20 Feb 2019)

  Changed paths:
    M hw/usb/core.c

  Log Message:
  -----------
  usb: remove unnecessary NULL device check from usb_ep_get()

No caller of usb_ep_get() calls it with a NULL device (previous commits
have addressed the few remaining cases which didn't explicitly check).
Replace check for 'dev == NULL' with an assert instead.

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 039e406603852e9ddb23b5965b6956d42304bc55
      
https://github.com/qemu/qemu/commit/039e406603852e9ddb23b5965b6956d42304bc55
  Author: Peter Maydell <address@hidden>
  Date:   2019-02-21 (Thu, 21 Feb 2019)

  Changed paths:
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-musb.c
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M hw/usb/hcd-xhci.c
    M hw/usb/redirect.c

  Log Message:
  -----------
  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) <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>" [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 <address@hidden>


Compare: https://github.com/qemu/qemu/compare/2e68b8620637...039e40660385



reply via email to

[Prev in Thread] Current Thread [Next in Thread]