svn commit: r349613 - head/stand/efi/libefi
Toomas Soome
tsoome at FreeBSD.org
Tue Jul 2 20:32:36 UTC 2019
Author: tsoome
Date: Tue Jul 2 20:32:35 2019
New Revision: 349613
URL: https://svnweb.freebsd.org/changeset/base/349613
Log:
efihttp: mac and err can be used uninitialized
While there, also check if mac != NULL, and use pointer compare for ipv4
and dns.
Modified:
head/stand/efi/libefi/efihttp.c
Modified: head/stand/efi/libefi/efihttp.c
==============================================================================
--- head/stand/efi/libefi/efihttp.c Tue Jul 2 19:51:40 2019 (r349612)
+++ head/stand/efi/libefi/efihttp.c Tue Jul 2 20:32:35 2019 (r349613)
@@ -127,9 +127,11 @@ setup_ipv4_config2(EFI_HANDLE handle, MAC_ADDR_DEVICE_
(void **)&ip4config2, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
- if (ipv4) {
- setenv("boot.netif.hwaddr",
- ether_sprintf((u_char *)mac->MacAddress.Addr), 1);
+ if (ipv4 != NULL) {
+ if (mac != NULL) {
+ setenv("boot.netif.hwaddr",
+ ether_sprintf((u_char *)mac->MacAddress.Addr), 1);
+ }
setenv("boot.netif.ip",
inet_ntoa(*(struct in_addr *)ipv4->LocalIpAddress.Addr), 1);
setenv("boot.netif.netmask",
@@ -160,7 +162,7 @@ setup_ipv4_config2(EFI_HANDLE handle, MAC_ADDR_DEVICE_
return (efi_status_to_errno(status));
}
- if (dns) {
+ if (dns != NULL) {
status = ip4config2->SetData(ip4config2,
Ip4Config2DataTypeDnsServer,
sizeof(EFI_IPv4_ADDRESS), &dns->DnsServerIp);
@@ -252,6 +254,7 @@ efihttp_dev_open(struct open_file *f, ...)
status = BS->LocateDevicePath(&httpsb_guid, &devpath, &handle);
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
+ mac = NULL;
ipv4 = NULL;
dns = NULL;
uri = NULL;
@@ -662,7 +665,7 @@ static int
efihttp_fs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
{
size_t res;
- int err;
+ int err = 0;
while (size > 0) {
err = _efihttp_fs_read(f, buf, size, &res);
More information about the svn-src-all
mailing list