nalika / rpms / grub2

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