dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

23d2ea
From af63e7cec2c4b0bcd59ff4d8ad323635443f3054 Mon Sep 17 00:00:00 2001
23d2ea
From: Peter Jones <pjones@redhat.com>
23d2ea
Date: Mon, 11 Jul 2016 15:57:28 -0400
23d2ea
Subject: [PATCH 208/208] 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
23d2ea
index 4793ebc..46ce813 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
23d2ea
index e1955bc..ddee4e6 100644
23d2ea
--- a/grub-core/net/drivers/efi/efinet.c
23d2ea
+++ b/grub-core/net/drivers/efi/efinet.c
23d2ea
@@ -474,6 +474,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",
23d2ea
@@ -487,10 +488,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
-- 
23d2ea
2.5.5
23d2ea