SecurityPkg/Tcg/OpalPasswordDxe: Fix logic for RemoveDevice()
First, If there are multiple devices in DeviceList and are going to remove the first device in the DeviceList, the DeviceList will be cleared up with setting to NULL. This is not the expected behavior, as it should keep the rest of the devices in the DeviceList. DeviceList should point to the next device, Dev->Next. Second, there is a potential infinite while loop if TmpDev->Next not equal to Dev. TmpDev should point to next device. Signed-off-by: Hunter Chang <hunter.chang@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
bd785cedc3
commit
504a80c151
@@ -2329,7 +2329,7 @@ RemoveDevice (
|
||||
}
|
||||
|
||||
if (mOpalDriver.DeviceList == Dev) {
|
||||
mOpalDriver.DeviceList = NULL;
|
||||
mOpalDriver.DeviceList = Dev->Next;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2339,6 +2339,8 @@ RemoveDevice (
|
||||
TmpDev->Next = Dev->Next;
|
||||
break;
|
||||
}
|
||||
|
||||
TmpDev = TmpDev->Next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user