svn commit: r300791 - head/sys/boot/efi/libefi
John Baldwin
jhb at FreeBSD.org
Thu May 26 23:08:59 UTC 2016
Author: jhb
Date: Thu May 26 23:08:57 2016
New Revision: 300791
URL: https://svnweb.freebsd.org/changeset/base/300791
Log:
Use a unique error message if we fail to find the simple network protocol.
While here, fix the various net driver callbacks to return early instead
of crashing if this fails. (The 'init' callback from the netif interface
doesn't return an error if the protocol lookup fails.)
Sponsored by: Cisco Systems
Modified:
head/sys/boot/efi/libefi/efinet.c
Modified: head/sys/boot/efi/libefi/efinet.c
==============================================================================
--- head/sys/boot/efi/libefi/efinet.c Thu May 26 23:07:20 2016 (r300790)
+++ head/sys/boot/efi/libefi/efinet.c Thu May 26 23:08:57 2016 (r300791)
@@ -122,6 +122,8 @@ efinet_put(struct iodesc *desc, void *pk
void *buf;
net = nif->nif_devdata;
+ if (net == NULL)
+ return (-1);
status = net->Transmit(net, 0, len, pkt, 0, 0, 0);
if (status != EFI_SUCCESS)
@@ -152,6 +154,8 @@ efinet_get(struct iodesc *desc, void *pk
char buf[2048];
net = nif->nif_devdata;
+ if (net == NULL)
+ return (0);
t = time(0);
while ((time(0) - t) < timeout) {
@@ -192,7 +196,7 @@ efinet_init(struct iodesc *desc, void *m
h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata);
if (status != EFI_SUCCESS) {
- printf("net%d: cannot start interface (status=%lu)\n",
+ printf("net%d: cannot fetch interface data (status=%lu)\n",
nif->nif_unit, EFI_ERROR_CODE(status));
return;
}
@@ -241,6 +245,9 @@ efinet_end(struct netif *nif)
{
EFI_SIMPLE_NETWORK *net = nif->nif_devdata;
+ if (net == NULL)
+ return;
+
net->Shutdown(net);
}
More information about the svn-src-all
mailing list