changeset 5090:b59f8109c799

6576808 R_malloc can fail and the result is not checked, possibly panicking
author sangeeta
date Wed, 19 Sep 2007 09:49:50 -0700
parents 08c2b93cbb19
children 7a81097e277f
files usr/src/uts/common/inet/ip/ip_ftable.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/inet/ip/ip_ftable.c	Wed Sep 19 09:03:25 2007 -0700
+++ b/usr/src/uts/common/inet/ip/ip_ftable.c	Wed Sep 19 09:49:50 2007 -0700
@@ -916,7 +916,8 @@
 	/* Obtain dst_ill */
 	dst_ill = ip_newroute_get_dst_ill(ire->ire_ipif->ipif_ill);
 	if (dst_ill == NULL) {
-		ip2dbg(("ire_forward no dst ill; ire 0x%p\n", (void *)ire));
+		ip2dbg(("ire_forward no dst ill; ire 0x%p\n",
+		    (void *)ire));
 		goto icmp_err_ret;
 	}
 
@@ -1110,6 +1111,10 @@
 	 * add the route. based on BSD's rtrequest1(RTM_ADD)
 	 */
 	R_Malloc(rt, rt_entry_cache,  sizeof (*rt));
+	/* kmem_alloc failed */
+	if (rt == NULL)
+		return (NULL);
+
 	(void) memset(rt, 0, sizeof (*rt));
 	rt->rt_nodes->rn_key = (char *)&rt->rt_dst;
 	rt->rt_dst = rdst;