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