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

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