Blame SOURCES/0207-efinet-fix-some-coverity-gripes.patch

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