mirror of https://github.com/acidanthera/audk.git
error handling enhancement for possible null pointer dereference
Signed-off-by: erictian Reviewed-by: ydong10 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12437 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2256f1f757
commit
d12c6a78aa
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
The module to produce Usb Bus PPI.
|
The module to produce Usb Bus PPI.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions
|
are licensed and made available under the terms and conditions
|
||||||
|
@ -380,18 +380,21 @@ PeiUsbEnumeration (
|
||||||
|
|
||||||
|
|
||||||
CurrentAddress = 0;
|
CurrentAddress = 0;
|
||||||
if (Usb2HcPpi != NULL){
|
if (Usb2HcPpi != NULL) {
|
||||||
Usb2HcPpi->GetRootHubPortNumber (
|
Usb2HcPpi->GetRootHubPortNumber (
|
||||||
PeiServices,
|
PeiServices,
|
||||||
Usb2HcPpi,
|
Usb2HcPpi,
|
||||||
(UINT8 *) &NumOfRootPort
|
(UINT8 *) &NumOfRootPort
|
||||||
);
|
);
|
||||||
} else {
|
} else if (UsbHcPpi != NULL) {
|
||||||
UsbHcPpi->GetRootHubPortNumber (
|
UsbHcPpi->GetRootHubPortNumber (
|
||||||
PeiServices,
|
PeiServices,
|
||||||
UsbHcPpi,
|
UsbHcPpi,
|
||||||
(UINT8 *) &NumOfRootPort
|
(UINT8 *) &NumOfRootPort
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < NumOfRootPort; Index++) {
|
for (Index = 0; Index < NumOfRootPort; Index++) {
|
||||||
|
|
|
@ -627,13 +627,18 @@ SetKeyboardLayoutEvent (
|
||||||
//
|
//
|
||||||
KeyCode = EfiKeyToUsbKeyCodeConvertionTable [(UINT8) (TempKey.Key)];
|
KeyCode = EfiKeyToUsbKeyCodeConvertionTable [(UINT8) (TempKey.Key)];
|
||||||
TableEntry = GetKeyDescriptor (UsbKeyboardDevice, KeyCode);
|
TableEntry = GetKeyDescriptor (UsbKeyboardDevice, KeyCode);
|
||||||
|
if (TableEntry == NULL) {
|
||||||
|
ReleaseKeyboardLayoutResources (UsbKeyboardDevice);
|
||||||
|
FreePool (KeyboardLayout);
|
||||||
|
return;
|
||||||
|
}
|
||||||
CopyMem (TableEntry, KeyDescriptor, sizeof (EFI_KEY_DESCRIPTOR));
|
CopyMem (TableEntry, KeyDescriptor, sizeof (EFI_KEY_DESCRIPTOR));
|
||||||
|
|
||||||
//
|
//
|
||||||
// For non-spacing key, create the list with a non-spacing key followed by physical keys.
|
// For non-spacing key, create the list with a non-spacing key followed by physical keys.
|
||||||
//
|
//
|
||||||
if (TempKey.Modifier == EFI_NS_KEY_MODIFIER) {
|
if (TempKey.Modifier == EFI_NS_KEY_MODIFIER) {
|
||||||
UsbNsKey = AllocatePool (sizeof (USB_NS_KEY));
|
UsbNsKey = AllocateZeroPool (sizeof (USB_NS_KEY));
|
||||||
ASSERT (UsbNsKey != NULL);
|
ASSERT (UsbNsKey != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue