dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
23d2ea
From: Peter Jones <pjones@redhat.com>
23d2ea
Date: Mon, 11 Jul 2016 15:57:28 -0400
28f7f8
Subject: [PATCH] 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
28f7f8
index 4793ebc434e..46ce8135ac5 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
28f7f8
index ed103df7a80..2244f14030f 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
       {