Skip to content

Commit 84c0c87

Browse files
YangLiang3wenlingz
authored andcommitted
DM USB: xHCI: Fix a potential NULL pointer issue.
After excap pointer is assigned, it should be checked whether it's possible to get assignment for NULL pointer or not. This patch fixes this issue. Tracked-On: #1479 Signed-off-by: Liang Yang <liang3.yang@intel.com> Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Reviewed-by: Liu Shuo <shuo.a.liu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent 1568a4c commit 84c0c87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

devicemodel/hw/pci/xhci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4001,13 +4001,13 @@ pci_xhci_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
40014001
* ended by EXCAP_GROUP_END at last item.
40024002
*/
40034003
excap = xdev->excap_ptr;
4004-
xdev->excapoff = excap->start;
4005-
40064004
if (!excap) {
4007-
UPRINTF(LWRN, "Failed to set xHCI extended capability\r\n");
4008-
return -1;
4005+
error = -1;
4006+
goto done;
40094007
}
40104008

4009+
xdev->excapoff = excap->start;
4010+
40114011
do {
40124012
xdev->regsend = excap->end;
40134013
excap++;

0 commit comments

Comments
 (0)