Blame SOURCES/autofs-5.0.7-fix-host_addr-null-reference-in-add_new_host.patch

304803
autofs-5.0.7 - fix host_addr null reference in add_new_host()
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
The function add_new_host() is always called from a loop that depends
304803
on host_addr being non-null.
304803
304803
Remove the redundant check.
304803
---
304803
 modules/replicated.c |   29 ++++++++++-------------------
304803
 1 file changed, 10 insertions(+), 19 deletions(-)
304803
304803
diff --git a/modules/replicated.c b/modules/replicated.c
304803
index 0a044b9..e793ca4 100644
304803
--- a/modules/replicated.c
304803
+++ b/modules/replicated.c
304803
@@ -1030,28 +1030,19 @@ static int add_new_host(struct host **list,
304803
 	unsigned int prx;
304803
 	int addr_len;
304803
 
304803
+	prx = get_proximity(host_addr->ai_addr);
304803
+
304803
 	/*
304803
-	 * If we are using random selection we pretend all hosts are at
304803
-	 * the same proximity so hosts further away don't get excluded.
304803
-	 * We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
304803
-	 * to remove hosts that may be down.
304803
+	 * If we want the weight to be the determining factor
304803
+	 * when selecting a host, or we are using random selection,
304803
+	 * then all hosts must have the same proximity. However,
304803
+	 * if this is the local machine it should always be used
304803
+	 * since it is certainly available.
304803
 	 */
304803
-	if (!host_addr)
304803
+	if (prx != PROXIMITY_LOCAL &&
304803
+	   (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
304803
+		       MOUNT_FLAG_RANDOM_SELECT)))
304803
 		prx = PROXIMITY_SUBNET;
304803
-	else {
304803
-		prx = get_proximity(host_addr->ai_addr);
304803
-		/*
304803
-		 * If we want the weight to be the determining factor
304803
-		 * when selecting a host, or we are using random selection,
304803
-		 * then all hosts must have the same proximity. However,
304803
-		 * if this is the local machine it should always be used
304803
-		 * since it is certainly available.
304803
-		 */
304803
-		if (prx != PROXIMITY_LOCAL &&
304803
-		   (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
304803
-			       MOUNT_FLAG_RANDOM_SELECT)))
304803
-			prx = PROXIMITY_SUBNET;
304803
-	}
304803
 
304803
 	/*
304803
 	 * If we tried to add an IPv6 address and we don't have IPv6