From af63e7cec2c4b0bcd59ff4d8ad323635443f3054 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 11 Jul 2016 15:57:28 -0400
Subject: [PATCH 208/208] efinet: fix some coverity gripes.
Related: rhbz#1154226
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 9 +++++----
grub-core/net/drivers/efi/efinet.c | 11 +++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 4793ebc..46ce813 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -349,10 +349,11 @@ grub_net_configure_by_dhcpv6_ack (const char *name,
struct grub_net_network_level_address addr;
int mask = -1;
- if (device)
- *device = 0;
- if (path)
- *path = 0;
+ if (!device || !path)
+ return NULL;
+
+ *device = 0;
+ *path = 0;
grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n",
hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2],
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index e1955bc..ddee4e6 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -474,6 +474,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (pxe_mode->using_ipv6)
{
grub_net_link_level_address_t hwaddr;
+ struct grub_net_network_level_interface *intf;
grub_dprintf ("efinet", "using ipv6 and dhcpv6\n");
grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
@@ -487,10 +488,12 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
card->efi_net->mode->current_address,
sizeof (hwaddr.mac));
- grub_net_configure_by_dhcpv6_ack (card->name, card, 0,
- &hwaddr, &pxe_mode->dhcp_ack.dhcpv6,
- 1, device, path);
- grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0,
+ &hwaddr,
+ &pxe_mode->dhcp_ack.dhcpv6,
+ 1, device, path);
+ if (intf && device && path)
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
}
else
{
--
2.5.5