Page MenuHomeFreeBSD

D9203.diff
No OneTemporary

D9203.diff

Index: head/sys/boot/efi/libefi/devpath.c
===================================================================
--- head/sys/boot/efi/libefi/devpath.c
+++ head/sys/boot/efi/libefi/devpath.c
@@ -106,15 +106,18 @@
EFI_DEVICE_PATH *node, *copy;
size_t prefix, len;
- node = efi_devpath_last_node(devpath);
+ if ((node = efi_devpath_last_node(devpath)) == NULL)
+ return (NULL);
prefix = (UINT8 *)node - (UINT8 *)devpath;
if (prefix == 0)
return (NULL);
len = prefix + DevicePathNodeLength(NextDevicePathNode(node));
copy = malloc(len);
- memcpy(copy, devpath, prefix);
- node = (EFI_DEVICE_PATH *)((UINT8 *)copy + prefix);
- SetDevicePathEndNode(node);
+ if (copy != NULL) {
+ memcpy(copy, devpath, prefix);
+ node = (EFI_DEVICE_PATH *)((UINT8 *)copy + prefix);
+ SetDevicePathEndNode(node);
+ }
return (copy);
}
Index: head/sys/boot/efi/libefi/efinet.c
===================================================================
--- head/sys/boot/efi/libefi/efinet.c
+++ head/sys/boot/efi/libefi/efinet.c
@@ -291,12 +291,18 @@
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
handles2 = (EFI_HANDLE *)malloc(sz);
+ if (handles2 == NULL) {
+ free(handles);
+ return (ENOMEM);
+ }
nifs = 0;
for (i = 0; i < sz / sizeof(EFI_HANDLE); i++) {
devpath = efi_lookup_devpath(handles[i]);
if (devpath == NULL)
continue;
- node = efi_devpath_last_node(devpath);
+ if ((node = efi_devpath_last_node(devpath)) == NULL)
+ continue;
+
if (DevicePathType(node) != MESSAGING_DEVICE_PATH ||
DevicePathSubType(node) != MSG_MAC_ADDR_DP)
continue;
@@ -318,20 +324,24 @@
}
free(handles);
if (nifs == 0) {
- free(handles2);
- return (ENOENT);
+ err = ENOENT;
+ goto done;
}
err = efi_register_handles(&efinet_dev, handles2, NULL, nifs);
- if (err != 0) {
- free(handles2);
- return (err);
- }
+ if (err != 0)
+ goto done;
- efinetif.netif_nifs = nifs;
efinetif.netif_ifs = calloc(nifs, sizeof(struct netif_dif));
-
stats = calloc(nifs, sizeof(struct netif_stats));
+ if (efinetif.netif_ifs == NULL || stats == NULL) {
+ free(efinetif.netif_ifs);
+ free(stats);
+ efinetif.netif_ifs = NULL;
+ err = ENOMEM;
+ goto done;
+ }
+ efinetif.netif_nifs = nifs;
for (i = 0; i < nifs; i++) {
@@ -341,9 +351,9 @@
dif->dif_stats = &stats[i];
dif->dif_private = handles2[i];
}
+done:
free(handles2);
-
- return (0);
+ return (err);
}
static int
Index: head/sys/boot/efi/libefi/efipart.c
===================================================================
--- head/sys/boot/efi/libefi/efipart.c
+++ head/sys/boot/efi/libefi/efipart.c
@@ -130,10 +130,13 @@
* we try to find the parent device and add that instead as
* that will be the CD filesystem.
*/
- node = efi_devpath_last_node(devpath);
+ if ((node = efi_devpath_last_node(devpath)) == NULL)
+ continue;
if (DevicePathType(node) == MEDIA_DEVICE_PATH &&
DevicePathSubType(node) == MEDIA_CDROM_DP) {
devpathcpy = efi_devpath_trim(devpath);
+ if (devpathcpy == NULL)
+ continue;
tmpdevpath = devpathcpy;
status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath,
&handle);

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 7, 8:18 AM (19 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17028269
Default Alt Text
D9203.diff (3 KB)

Event Timeline